[colyli-bcache:nvdimm-meta 23/23] include/linux/fortify-string.h:20:33: warning: argument 2 null where non-null expected

From: kernel test robot
Date: Sat Oct 30 2021 - 15:12:02 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/colyli/linux-bcache.git nvdimm-meta
head: ae554f9c5f1d65c3279a7a6e6881569487483403
commit: ae554f9c5f1d65c3279a7a6e6881569487483403 [23/23] bcache: store btree nodes on nvdimm
config: mips-randconfig-r012-20211031 (attached as .config)
compiler: mips64el-linux-gcc (GCC) 11.2.0
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
# https://git.kernel.org/pub/scm/linux/kernel/git/colyli/linux-bcache.git/commit/?id=ae554f9c5f1d65c3279a7a6e6881569487483403
git remote add colyli-bcache https://git.kernel.org/pub/scm/linux/kernel/git/colyli/linux-bcache.git
git fetch --no-tags colyli-bcache nvdimm-meta
git checkout ae554f9c5f1d65c3279a7a6e6881569487483403
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=mips

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

In file included from drivers/md/bcache/nvmpg.h:8,
from drivers/md/bcache/btree.c:29:
drivers/md/bcache/nvmpg_format.h:132:19: warning: 'bch_nvmpg_recs_magic' defined but not used [-Wunused-const-variable=]
132 | static const __u8 bch_nvmpg_recs_magic[] = {
| ^~~~~~~~~~~~~~~~~~~~
drivers/md/bcache/nvmpg_format.h:129:19: warning: 'bch_nvmpg_magic' defined but not used [-Wunused-const-variable=]
129 | static const __u8 bch_nvmpg_magic[] = {
| ^~~~~~~~~~~~~~~
In file included from include/linux/string.h:262,
from include/linux/bitmap.h:10,
from include/linux/cpumask.h:12,
from arch/mips/include/asm/processor.h:15,
from arch/mips/include/asm/thread_info.h:16,
from include/linux/thread_info.h:60,
from include/asm-generic/preempt.h:5,
from ./arch/mips/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:78,
from include/linux/spinlock.h:55,
from include/linux/wait.h:9,
from include/linux/mempool.h:8,
from include/linux/bio.h:8,
from drivers/md/bcache/bcache.h:181,
from drivers/md/bcache/btree.c:24:
In function 'memcpy',
inlined from '__bch_nvmpg_btree_node_read' at drivers/md/bcache/btree.c:287:2,
inlined from 'bch_btree_node_read' at drivers/md/bcache/btree.c:307:3:
>> include/linux/fortify-string.h:20:33: warning: argument 2 null where non-null expected [-Wnonnull]
20 | #define __underlying_memcpy __builtin_memcpy
| ^
include/linux/fortify-string.h:191:16: note: in expansion of macro '__underlying_memcpy'
191 | return __underlying_memcpy(p, q, size);
| ^~~~~~~~~~~~~~~~~~~
drivers/md/bcache/btree.c: In function 'bch_btree_node_read':
include/linux/fortify-string.h:20:33: note: in a call to built-in function '__builtin_memcpy'
20 | #define __underlying_memcpy __builtin_memcpy
| ^
include/linux/fortify-string.h:191:16: note: in expansion of macro '__underlying_memcpy'
191 | return __underlying_memcpy(p, q, size);
| ^~~~~~~~~~~~~~~~~~~
In function 'memcpy',
inlined from 'memcpy_flushcache' at include/linux/string.h:167:2,
inlined from '__do_nvmpg_btree_node_write' at drivers/md/bcache/btree.c:475:2,
inlined from 'do_btree_node_write' at drivers/md/bcache/btree.c:491:3,
inlined from '__bch_btree_node_write' at drivers/md/bcache/btree.c:517:2:
include/linux/fortify-string.h:20:33: warning: argument 1 null where non-null expected [-Wnonnull]
20 | #define __underlying_memcpy __builtin_memcpy
| ^
include/linux/fortify-string.h:191:16: note: in expansion of macro '__underlying_memcpy'
191 | return __underlying_memcpy(p, q, size);
| ^~~~~~~~~~~~~~~~~~~
drivers/md/bcache/btree.c: In function '__bch_btree_node_write':
include/linux/fortify-string.h:20:33: note: in a call to built-in function '__builtin_memcpy'
20 | #define __underlying_memcpy __builtin_memcpy
| ^
include/linux/fortify-string.h:191:16: note: in expansion of macro '__underlying_memcpy'
191 | return __underlying_memcpy(p, q, size);
| ^~~~~~~~~~~~~~~~~~~


vim +20 include/linux/fortify-string.h

a28a6e860c6cf2 Francis Laniel 2021-02-25 4
a28a6e860c6cf2 Francis Laniel 2021-02-25 5
a28a6e860c6cf2 Francis Laniel 2021-02-25 6 #if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
a28a6e860c6cf2 Francis Laniel 2021-02-25 7 extern void *__underlying_memchr(const void *p, int c, __kernel_size_t size) __RENAME(memchr);
a28a6e860c6cf2 Francis Laniel 2021-02-25 8 extern int __underlying_memcmp(const void *p, const void *q, __kernel_size_t size) __RENAME(memcmp);
a28a6e860c6cf2 Francis Laniel 2021-02-25 9 extern void *__underlying_memcpy(void *p, const void *q, __kernel_size_t size) __RENAME(memcpy);
a28a6e860c6cf2 Francis Laniel 2021-02-25 10 extern void *__underlying_memmove(void *p, const void *q, __kernel_size_t size) __RENAME(memmove);
a28a6e860c6cf2 Francis Laniel 2021-02-25 11 extern void *__underlying_memset(void *p, int c, __kernel_size_t size) __RENAME(memset);
a28a6e860c6cf2 Francis Laniel 2021-02-25 12 extern char *__underlying_strcat(char *p, const char *q) __RENAME(strcat);
a28a6e860c6cf2 Francis Laniel 2021-02-25 13 extern char *__underlying_strcpy(char *p, const char *q) __RENAME(strcpy);
a28a6e860c6cf2 Francis Laniel 2021-02-25 14 extern __kernel_size_t __underlying_strlen(const char *p) __RENAME(strlen);
a28a6e860c6cf2 Francis Laniel 2021-02-25 15 extern char *__underlying_strncat(char *p, const char *q, __kernel_size_t count) __RENAME(strncat);
a28a6e860c6cf2 Francis Laniel 2021-02-25 16 extern char *__underlying_strncpy(char *p, const char *q, __kernel_size_t size) __RENAME(strncpy);
a28a6e860c6cf2 Francis Laniel 2021-02-25 17 #else
a28a6e860c6cf2 Francis Laniel 2021-02-25 18 #define __underlying_memchr __builtin_memchr
a28a6e860c6cf2 Francis Laniel 2021-02-25 19 #define __underlying_memcmp __builtin_memcmp
a28a6e860c6cf2 Francis Laniel 2021-02-25 @20 #define __underlying_memcpy __builtin_memcpy
a28a6e860c6cf2 Francis Laniel 2021-02-25 21 #define __underlying_memmove __builtin_memmove
a28a6e860c6cf2 Francis Laniel 2021-02-25 22 #define __underlying_memset __builtin_memset
a28a6e860c6cf2 Francis Laniel 2021-02-25 23 #define __underlying_strcat __builtin_strcat
a28a6e860c6cf2 Francis Laniel 2021-02-25 24 #define __underlying_strcpy __builtin_strcpy
a28a6e860c6cf2 Francis Laniel 2021-02-25 25 #define __underlying_strlen __builtin_strlen
a28a6e860c6cf2 Francis Laniel 2021-02-25 26 #define __underlying_strncat __builtin_strncat
a28a6e860c6cf2 Francis Laniel 2021-02-25 27 #define __underlying_strncpy __builtin_strncpy
a28a6e860c6cf2 Francis Laniel 2021-02-25 28 #endif
a28a6e860c6cf2 Francis Laniel 2021-02-25 29

:::::: The code at line 20 was first introduced by commit
:::::: a28a6e860c6cf231cf3c5171c75c342adcd00406 string.h: move fortified functions definitions in a dedicated header.

:::::: TO: Francis Laniel <laniel_francis@xxxxxxxxxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip