CC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Eric Biggers <[email protected]>
CC: Hannes Reinecke <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git 
fscrypt-pending
head:   38ef66b05cfa3560323344a0b3e09e583f1eb974
commit: ba47b515f59406038a6ad763d4aff1ab50be2038 [6/7] fscrypt: align Base64 
encoding with RFC 4648 base64url
:::::: branch date: 3 hours ago
:::::: commit date: 3 days ago
config: x86_64-randconfig-c001-20210728 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 
c49df15c278857adecd12db6bb1cdc96885f7079)
reproduce (this is a W=1 build):
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # 
https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/commit/?id=ba47b515f59406038a6ad763d4aff1ab50be2038
        git remote add ebiggers 
https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git
        git fetch --no-tags ebiggers fscrypt-pending
        git checkout ba47b515f59406038a6ad763d4aff1ab50be2038
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 
clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>


clang-analyzer warnings: (new ones prefixed by >>)
   8 warnings generated.
   Suppressed 8 warnings (8 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   8 warnings generated.
   drivers/char/mem.c:690:21: warning: Excessive padding in 'struct memdev' (10 
padding bytes, where 2 is optimal). 
   Optimal fields order: 
   name, 
   fops, 
   fmode, 
   mode, 
   consider reordering the fields or adding explicit padding members 
[clang-analyzer-optin.performance.Padding]
   static const struct memdev {
                ~~~~~~~^~~~~~~~
   drivers/char/mem.c:690:21: note: Excessive padding in 'struct memdev' (10 
padding bytes, where 2 is optimal). Optimal fields order: name, fops, fmode, 
mode, consider reordering the fields or adding explicit padding members
   static const struct memdev {
                ~~~~~~~^~~~~~~~
   Suppressed 7 warnings (7 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   8 warnings generated.
   Suppressed 8 warnings (7 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   10 warnings generated.
   drivers/char/applicom.c:571:5: warning: Value stored to 'ret' is never read 
[clang-analyzer-deadcode.DeadStores]
                                   ret = do_ac_read(i, buf, &st_loc, &mailbox);
                                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/char/applicom.c:571:5: note: Value stored to 'ret' is never read
                                   ret = do_ac_read(i, buf, &st_loc, &mailbox);
                                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 9 warnings (6 in non-user code, 3 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   7 warnings generated.
   Suppressed 7 warnings (7 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   7 warnings generated.
   Suppressed 7 warnings (7 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   7 warnings generated.
   Suppressed 7 warnings (7 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   9 warnings generated.
   fs/exfat/inode.c:148:3: warning: Value stored to 'clu_offset' is never read 
[clang-analyzer-deadcode.DeadStores]
                   clu_offset -= fclus;
                   ^             ~~~~~
   fs/exfat/inode.c:148:3: note: Value stored to 'clu_offset' is never read
                   clu_offset -= fclus;
                   ^             ~~~~~
   fs/exfat/inode.c:217:3: warning: Value stored to 'num_clusters' is never 
read [clang-analyzer-deadcode.DeadStores]
                   num_clusters += num_to_be_allocated;
                   ^               ~~~~~~~~~~~~~~~~~~~
   fs/exfat/inode.c:217:3: note: Value stored to 'num_clusters' is never read
                   num_clusters += num_to_be_allocated;
                   ^               ~~~~~~~~~~~~~~~~~~~
   Suppressed 7 warnings (7 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   9 warnings generated.
   drivers/cdrom/cdrom.c:877:7: warning: Although the value stored to 'ret' is 
used in the enclosing expression, the value is never actually read from 'ret' 
[clang-analyzer-deadcode.DeadStores]
           if ((ret = cdi->ops->generic_packet(cdi, &cgc)))
                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/cdrom/cdrom.c:877:7: note: Although the value stored to 'ret' is 
used in the enclosing expression, the value is never actually read from 'ret'
           if ((ret = cdi->ops->generic_packet(cdi, &cgc)))
                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/cdrom/cdrom.c:1374:7: warning: Although the value stored to 'status' 
is used in the enclosing expression, the value is never actually read from 
'status' [clang-analyzer-deadcode.DeadStores]
           if ((status = cdrom_read_mech_status(cdi, info)) == 0)
                ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/cdrom/cdrom.c:1374:7: note: Although the value stored to 'status' is 
used in the enclosing expression, the value is never actually read from 'status'
           if ((status = cdrom_read_mech_status(cdi, info)) == 0)
                ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 7 warnings (7 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   7 warnings generated.
   Suppressed 7 warnings (7 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   7 warnings generated.
   Suppressed 7 warnings (7 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   8 warnings generated.
>> fs/crypto/fname.c:209:18: warning: The right operand of '|' is a garbage 
>> value [clang-analyzer-core.UndefinedBinaryOperatorResult]
                   ac = (ac << 8) | src[i];
                                  ^
   fs/crypto/fname.c:346:2: note: Taking false branch
           if (fscrypt_is_dot_dotdot(&qname)) {
           ^
   fs/crypto/fname.c:353:6: note: Assuming field 'len' is >= 
FS_CRYPTO_BLOCK_SIZE
           if (iname->len < FS_CRYPTO_BLOCK_SIZE)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/crypto/fname.c:353:2: note: Taking false branch
           if (iname->len < FS_CRYPTO_BLOCK_SIZE)
           ^
   fs/crypto/fname.c:356:2: note: Taking false branch
           if (fscrypt_has_encryption_key(inode))
           ^
   fs/crypto/fname.c:363:2: note: Taking false branch
           BUILD_BUG_ON(offsetofend(struct fscrypt_nokey_name, dirhash) !=
           ^
   include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON'
           BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
           ^
   include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
   #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                       ^
   include/linux/compiler_types.h:328:2: note: expanded from macro 
'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, 
__COUNTER__)
           ^
   include/linux/compiler_types.h:316:2: note: expanded from macro 
'_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:308:3: note: expanded from macro 
'__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   fs/crypto/fname.c:363:2: note: Loop condition is false.  Exiting loop
           BUILD_BUG_ON(offsetofend(struct fscrypt_nokey_name, dirhash) !=
           ^
   include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON'
           BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
           ^
   include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
   #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                       ^
   include/linux/compiler_types.h:328:2: note: expanded from macro 
'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, 
__COUNTER__)
           ^
   include/linux/compiler_types.h:316:2: note: expanded from macro 
'_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:306:2: note: expanded from macro 
'__compiletime_assert'
           do {                                                            \
           ^
   fs/crypto/fname.c:365:2: note: Taking false branch
           BUILD_BUG_ON(offsetofend(struct fscrypt_nokey_name, bytes) !=
           ^
   include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON'
           BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
           ^
   include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
   #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                       ^
   include/linux/compiler_types.h:328:2: note: expanded from macro 
'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, 
__COUNTER__)
           ^
   include/linux/compiler_types.h:316:2: note: expanded from macro 
'_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:308:3: note: expanded from macro 
'__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   fs/crypto/fname.c:365:2: note: Loop condition is false.  Exiting loop
           BUILD_BUG_ON(offsetofend(struct fscrypt_nokey_name, bytes) !=
           ^
   include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON'
           BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
           ^
   include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
   #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                       ^
   include/linux/compiler_types.h:328:2: note: expanded from macro 
'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, 
__COUNTER__)
           ^
   include/linux/compiler_types.h:316:2: note: expanded from macro 
'_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:306:2: note: expanded from macro 
'__compiletime_assert'
           do {                                                            \
           ^
   fs/crypto/fname.c:367:2: note: Taking false branch
           BUILD_BUG_ON(FSCRYPT_NOKEY_NAME_MAX_ENCODED > NAME_MAX);
           ^
   include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON'
           BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
           ^
   include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
   #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                       ^
   include/linux/compiler_types.h:328:2: note: expanded from macro 
'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, 
__COUNTER__)
           ^
   include/linux/compiler_types.h:316:2: note: expanded from macro 
'_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)

vim +209 fs/crypto/fname.c

17159420a6c18bb fs/crypto/fname.c      Eric Biggers 2017-04-24  186  
6b3bd08f93a849e fs/f2fs/crypto_fname.c Jaegeuk Kim  2015-04-26  187  /**
ba47b515f594060 fs/crypto/fname.c      Eric Biggers 2021-07-17  188   * 
fscrypt_base64url_encode() - base64url-encode some binary data
ba47b515f594060 fs/crypto/fname.c      Eric Biggers 2021-07-17  189   * @src: 
the binary data to encode
ba47b515f594060 fs/crypto/fname.c      Eric Biggers 2021-07-17  190   * 
@srclen: the length of @src in bytes
ba47b515f594060 fs/crypto/fname.c      Eric Biggers 2021-07-17  191   * @dst: 
(output) the base64url-encoded string.  Not NUL-terminated.
6b3bd08f93a849e fs/f2fs/crypto_fname.c Jaegeuk Kim  2015-04-26  192   *
ba47b515f594060 fs/crypto/fname.c      Eric Biggers 2021-07-17  193   * Encodes 
data using base64url encoding, i.e. the "Base 64 Encoding with URL
ba47b515f594060 fs/crypto/fname.c      Eric Biggers 2021-07-17  194   * and 
Filename Safe Alphabet" specified by RFC 4648.  '='-padding isn't used,
ba47b515f594060 fs/crypto/fname.c      Eric Biggers 2021-07-17  195   * as it's 
unneeded and not required by the RFC.  base64url is used instead of
ba47b515f594060 fs/crypto/fname.c      Eric Biggers 2021-07-17  196   * base64 
to avoid the '/' character, which isn't allowed in filenames.
1c5100a2aab4143 fs/crypto/fname.c      Eric Biggers 2019-07-24  197   *
ba47b515f594060 fs/crypto/fname.c      Eric Biggers 2021-07-17  198   * Return: 
the length of the resulting base64url-encoded string in bytes.
ba47b515f594060 fs/crypto/fname.c      Eric Biggers 2021-07-17  199   *    This 
will be equal to FSCRYPT_BASE64URL_CHARS(srclen).
6b3bd08f93a849e fs/f2fs/crypto_fname.c Jaegeuk Kim  2015-04-26  200   */
ba47b515f594060 fs/crypto/fname.c      Eric Biggers 2021-07-17  201  static int 
fscrypt_base64url_encode(const u8 *src, int srclen, char *dst)
6b3bd08f93a849e fs/f2fs/crypto_fname.c Jaegeuk Kim  2015-04-26  202  {
ba47b515f594060 fs/crypto/fname.c      Eric Biggers 2021-07-17  203     u32 ac 
= 0;
ba47b515f594060 fs/crypto/fname.c      Eric Biggers 2021-07-17  204     int 
bits = 0;
ba47b515f594060 fs/crypto/fname.c      Eric Biggers 2021-07-17  205     int i;
6b3bd08f93a849e fs/f2fs/crypto_fname.c Jaegeuk Kim  2015-04-26  206     char 
*cp = dst;
6b3bd08f93a849e fs/f2fs/crypto_fname.c Jaegeuk Kim  2015-04-26  207  
ba47b515f594060 fs/crypto/fname.c      Eric Biggers 2021-07-17  208     for (i 
= 0; i < srclen; i++) {
ba47b515f594060 fs/crypto/fname.c      Eric Biggers 2021-07-17 @209             
ac = (ac << 8) | src[i];
6b3bd08f93a849e fs/f2fs/crypto_fname.c Jaegeuk Kim  2015-04-26  210             
bits += 8;
6b3bd08f93a849e fs/f2fs/crypto_fname.c Jaegeuk Kim  2015-04-26  211             
do {
6b3bd08f93a849e fs/f2fs/crypto_fname.c Jaegeuk Kim  2015-04-26  212             
        bits -= 6;
ba47b515f594060 fs/crypto/fname.c      Eric Biggers 2021-07-17  213             
        *cp++ = base64url_table[(ac >> bits) & 0x3f];
6b3bd08f93a849e fs/f2fs/crypto_fname.c Jaegeuk Kim  2015-04-26  214             
} while (bits >= 6);
6b3bd08f93a849e fs/f2fs/crypto_fname.c Jaegeuk Kim  2015-04-26  215     }
6b3bd08f93a849e fs/f2fs/crypto_fname.c Jaegeuk Kim  2015-04-26  216     if 
(bits)
ba47b515f594060 fs/crypto/fname.c      Eric Biggers 2021-07-17  217             
*cp++ = base64url_table[(ac << (6 - bits)) & 0x3f];
6b3bd08f93a849e fs/f2fs/crypto_fname.c Jaegeuk Kim  2015-04-26  218     return 
cp - dst;
6b3bd08f93a849e fs/f2fs/crypto_fname.c Jaegeuk Kim  2015-04-26  219  }
6b3bd08f93a849e fs/f2fs/crypto_fname.c Jaegeuk Kim  2015-04-26  220  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to