[gustavoars-linux:for-next/array-bounds 2/2] arch/m68k/include/asm/string.h:72:25: warning: '__builtin_memcpy' offset 174 from the object at 'ls' is out of the bounds of referenced subobject 'ls_remove_spin' with type 'struct spinlock' at offset 174

From: kernel test robot
Date: Fri Jul 23 2021 - 07:46:52 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git for-next/array-bounds
head: 530fa69573b2e7c05bc744cedced782fa76fa3a5
commit: 530fa69573b2e7c05bc744cedced782fa76fa3a5 [2/2] Makefile: Enable -Warray-bounds=2
config: m68k-defconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 10.3.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/gustavoars/linux.git/commit/?id=530fa69573b2e7c05bc744cedced782fa76fa3a5
git remote add gustavoars-linux https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git
git fetch --no-tags gustavoars-linux for-next/array-bounds
git checkout 530fa69573b2e7c05bc744cedced782fa76fa3a5
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=m68k

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 include/linux/string.h:20,
from include/linux/bitmap.h:10,
from include/linux/cpumask.h:12,
from include/linux/smp.h:13,
from include/linux/lockdep.h:14,
from include/linux/rcupdate.h:29,
from include/linux/rbtree.h:22,
from fs/dlm/lock.c:57:
In function 'rsb_cmp',
inlined from 'wait_pending_remove' at fs/dlm/lock.c:1631:7,
inlined from 'set_master' at fs/dlm/lock.c:2749:2:
>> arch/m68k/include/asm/string.h:72:25: warning: '__builtin_memcpy' offset 174 from the object at 'ls' is out of the bounds of referenced subobject 'ls_remove_spin' with type 'struct spinlock' at offset 174 [-Warray-bounds]
72 | #define memcpy(d, s, n) __builtin_memcpy(d, s, n)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
fs/dlm/lock.c:441:2: note: in expansion of macro 'memcpy'
441 | memcpy(maxname, name, nlen);
| ^~~~~~
In file included from fs/dlm/lock.c:59:
fs/dlm/lock.c: In function 'set_master':
fs/dlm/dlm_internal.h:583:14: note: subobject 'ls_remove_spin' declared here
583 | spinlock_t ls_remove_spin;
| ^~~~~~~~~~~~~~
In file included from include/linux/string.h:20,
from include/linux/bitmap.h:10,
from include/linux/cpumask.h:12,
from include/linux/smp.h:13,
from include/linux/lockdep.h:14,
from include/linux/rcupdate.h:29,
from include/linux/rbtree.h:22,
from fs/dlm/lock.c:57:
fs/dlm/lock.c: In function 'shrink_bucket':
arch/m68k/include/asm/string.h:72:25: warning: '__builtin_memcpy' offset [174, 237] from the object at 'ls' is out of the bounds of referenced subobject 'ls_remove_spin' with type 'struct spinlock' at offset 174 [-Warray-bounds]
72 | #define memcpy(d, s, n) __builtin_memcpy(d, s, n)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
fs/dlm/lock.c:1784:3: note: in expansion of macro 'memcpy'
1784 | memcpy(ls->ls_remove_name, name, DLM_RESNAME_MAXLEN);
| ^~~~~~
In file included from fs/dlm/lock.c:59:
fs/dlm/dlm_internal.h:583:14: note: subobject 'ls_remove_spin' declared here
583 | spinlock_t ls_remove_spin;
| ^~~~~~~~~~~~~~
In file included from include/linux/string.h:20,
from include/linux/bitmap.h:10,
from include/linux/cpumask.h:12,
from include/linux/smp.h:13,
from include/linux/lockdep.h:14,
from include/linux/rcupdate.h:29,
from include/linux/rbtree.h:22,
from fs/dlm/lock.c:57:
>> arch/m68k/include/asm/string.h:68:25: warning: '__builtin_memset' offset [174, 237] from the object at 'ls' is out of the bounds of referenced subobject 'ls_remove_spin' with type 'struct spinlock' at offset 174 [-Warray-bounds]
68 | #define memset(d, c, n) __builtin_memset(d, c, n)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
fs/dlm/lock.c:1793:3: note: in expansion of macro 'memset'
1793 | memset(ls->ls_remove_name, 0, DLM_RESNAME_MAXLEN);
| ^~~~~~
In file included from fs/dlm/lock.c:59:
fs/dlm/dlm_internal.h:583:14: note: subobject 'ls_remove_spin' declared here
583 | spinlock_t ls_remove_spin;
| ^~~~~~~~~~~~~~
In file included from include/linux/string.h:20,
from include/linux/bitmap.h:10,
from include/linux/cpumask.h:12,
from include/linux/smp.h:13,
from include/linux/lockdep.h:14,
from include/linux/rcupdate.h:29,
from include/linux/rbtree.h:22,
from fs/dlm/lock.c:57:
fs/dlm/lock.c: In function 'send_repeat_remove':
arch/m68k/include/asm/string.h:72:25: warning: '__builtin_memcpy' offset [174, 237] from the object at 'ls' is out of the bounds of referenced subobject 'ls_remove_spin' with type 'struct spinlock' at offset 174 [-Warray-bounds]
72 | #define memcpy(d, s, n) __builtin_memcpy(d, s, n)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
fs/dlm/lock.c:4050:2: note: in expansion of macro 'memcpy'
4050 | memcpy(ls->ls_remove_name, name, DLM_RESNAME_MAXLEN);
| ^~~~~~
In file included from fs/dlm/lock.c:59:
fs/dlm/dlm_internal.h:583:14: note: subobject 'ls_remove_spin' declared here
583 | spinlock_t ls_remove_spin;
| ^~~~~~~~~~~~~~
In file included from include/linux/string.h:20,
from include/linux/bitmap.h:10,
from include/linux/cpumask.h:12,
from include/linux/smp.h:13,
from include/linux/lockdep.h:14,
from include/linux/rcupdate.h:29,
from include/linux/rbtree.h:22,
from fs/dlm/lock.c:57:
>> arch/m68k/include/asm/string.h:68:25: warning: '__builtin_memset' offset [174, 237] from the object at 'ls' is out of the bounds of referenced subobject 'ls_remove_spin' with type 'struct spinlock' at offset 174 [-Warray-bounds]
68 | #define memset(d, c, n) __builtin_memset(d, c, n)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
fs/dlm/lock.c:4066:2: note: in expansion of macro 'memset'
4066 | memset(ls->ls_remove_name, 0, DLM_RESNAME_MAXLEN);
| ^~~~~~
In file included from fs/dlm/lock.c:59:
fs/dlm/dlm_internal.h:583:14: note: subobject 'ls_remove_spin' declared here
583 | spinlock_t ls_remove_spin;
| ^~~~~~~~~~~~~~
--
In file included from include/linux/string.h:20,
from include/linux/bitmap.h:10,
from include/linux/cpumask.h:12,
from include/linux/smp.h:13,
from include/linux/lockdep.h:14,
from include/linux/spinlock.h:59,
from include/linux/mmzone.h:8,
from include/linux/gfp.h:6,
from include/linux/slab.h:15,
from fs/ocfs2/dlmglue.c:11:
fs/ocfs2/dlmglue.c: In function 'ocfs2_lock_res_free.part.0':
>> arch/m68k/include/asm/string.h:68:25: warning: '__builtin_memset' offset [86, 167] from the object at 'res' is out of the bounds of referenced subobject 'l_lock' with type 'struct spinlock' at offset 86 [-Warray-bounds]
68 | #define memset(d, c, n) __builtin_memset(d, c, n)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
fs/ocfs2/dlmglue.c:789:2: note: in expansion of macro 'memset'
789 | memset(&res->l_lksb, 0, sizeof(res->l_lksb));
| ^~~~~~
In file included from fs/ocfs2/dlmglue.c:25:
fs/ocfs2/ocfs2.h:182:27: note: subobject 'l_lock' declared here
182 | spinlock_t l_lock;
| ^~~~~~


vim +72 arch/m68k/include/asm/string.h

ea61bc461d09e8 Greg Ungerer 2010-09-07 65
ea61bc461d09e8 Greg Ungerer 2010-09-07 66 #define __HAVE_ARCH_MEMSET
ea61bc461d09e8 Greg Ungerer 2010-09-07 67 extern void *memset(void *, int, __kernel_size_t);
ea61bc461d09e8 Greg Ungerer 2010-09-07 @68 #define memset(d, c, n) __builtin_memset(d, c, n)
ea61bc461d09e8 Greg Ungerer 2010-09-07 69
ea61bc461d09e8 Greg Ungerer 2010-09-07 70 #define __HAVE_ARCH_MEMCPY
ea61bc461d09e8 Greg Ungerer 2010-09-07 71 extern void *memcpy(void *, const void *, __kernel_size_t);
ea61bc461d09e8 Greg Ungerer 2010-09-07 @72 #define memcpy(d, s, n) __builtin_memcpy(d, s, n)
ea61bc461d09e8 Greg Ungerer 2010-09-07 73

:::::: The code at line 72 was first introduced by commit
:::::: ea61bc461d09e8d331a307916530aaae808c72a2 m68k/m68knommu: merge MMU and non-MMU string.h

:::::: TO: Greg Ungerer <gerg@xxxxxxxxxxxx>
:::::: CC: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip