lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Fri, 21 Oct 2022 16:13:49 +0800
From:   kernel test robot <lkp@...el.com>
To:     Sweet Tea Dorminy <sweettea-kernel@...miny.me>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        David Sterba <dsterba@...e.com>
Subject: [kdave-btrfs-devel:ext/sweettea/fscrypt-v3 27/46]
 fs/crypto/crypto.c:97:30: sparse: sparse: bad assignment (+=) to restricted
 __le64

tree:   https://github.com/kdave/btrfs-devel.git ext/sweettea/fscrypt-v3
head:   4303e47e934b3af3940fbccf09515645b7084d78
commit: de4776dc6c651dbecf3aa4f8225aac3bf98e7690 [27/46] fscrypt: add extent-based encryption
config: x86_64-randconfig-s022
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-39-gce1a6720-dirty
        # https://github.com/kdave/btrfs-devel/commit/de4776dc6c651dbecf3aa4f8225aac3bf98e7690
        git remote add kdave-btrfs-devel https://github.com/kdave/btrfs-devel.git
        git fetch --no-tags kdave-btrfs-devel ext/sweettea/fscrypt-v3
        git checkout de4776dc6c651dbecf3aa4f8225aac3bf98e7690
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash fs/crypto/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>

sparse warnings: (new ones prefixed by >>)
>> fs/crypto/crypto.c:97:30: sparse: sparse: bad assignment (+=) to restricted __le64

vim +97 fs/crypto/crypto.c

    71	
    72	/*
    73	 * Generate the IV for the given logical block number within the given file.
    74	 * For filenames encryption, lblk_num == U64_MAX.
    75	 *
    76	 * Keep this in sync with fscrypt_limit_io_blocks().  fscrypt_limit_io_blocks()
    77	 * needs to know about any IV generation methods where the low bits of IV don't
    78	 * simply contain the lblk_num (e.g., IV_INO_LBLK_32).
    79	 */
    80	void fscrypt_generate_iv(union fscrypt_iv *iv, u64 lblk_num,
    81				 const struct fscrypt_info *ci)
    82	{
    83		u8 flags = fscrypt_policy_flags(&ci->ci_policy);
    84		struct inode *inode = ci->ci_inode;
    85		const struct fscrypt_operations *s_cop = inode->i_sb->s_cop;
    86	
    87		memset(iv, 0, sizeof(*iv));
    88		if (s_cop->get_extent_context && lblk_num != U64_MAX) {
    89			size_t extent_offset;
    90			union fscrypt_extent_context ctx;
    91			int ret;
    92	
    93			ret = fscrypt_get_extent_context(inode, lblk_num, &ctx,
    94							 &extent_offset, NULL);
    95			WARN_ON_ONCE(ret);
    96			memcpy(iv->raw, ctx.v1.iv.raw, sizeof(*iv));
  > 97			iv->lblk_num += cpu_to_le64(extent_offset);
    98			return;
    99		}
   100	
   101		/*
   102		 * Filename encryption. For inode-based policies, filenames are
   103		 * encrypted as though they are lblk 0.
   104		 */
   105		if (lblk_num == U64_MAX)
   106			lblk_num = 0;
   107	
   108		if (flags & FSCRYPT_POLICY_FLAG_IV_INO_LBLK_64) {
   109			WARN_ON_ONCE(lblk_num > U32_MAX);
   110			WARN_ON_ONCE(inode->i_ino > U32_MAX);
   111			lblk_num |= (u64)inode->i_ino << 32;
   112		} else if (flags & FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32) {
   113			WARN_ON_ONCE(lblk_num > U32_MAX);
   114			lblk_num = (u32)(ci->ci_hashed_ino + lblk_num);
   115		} else if (flags & FSCRYPT_POLICY_FLAG_DIRECT_KEY) {
   116			memcpy(iv->nonce, ci->ci_nonce, FSCRYPT_FILE_NONCE_SIZE);
   117		}
   118		iv->lblk_num = cpu_to_le64(lblk_num);
   119	}
   120	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (132483 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ