new __write_overflow_field compiler warning

From: Jeff Layton
Date: Tue May 17 2022 - 14:04:37 EST


Hi Kees,

I'm hoping you can help with this. I recently updated to Fedora 36,
which has gcc v12, and I've started seeing this warning pop up when
compiling the ceph.ko:

In file included from ./include/linux/string.h:253,
from ./include/linux/ceph/ceph_debug.h:7,
from fs/ceph/inode.c:2:
In function ‘fortify_memset_chk’,
inlined from ‘netfs_i_context_init’ at ./include/linux/netfs.h:326:2,
inlined from ‘ceph_alloc_inode’ at fs/ceph/inode.c:463:2:
./include/linux/fortify-string.h:242:25: warning: call to ‘__write_overflow_field’ declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning]
242 | __write_overflow_field(p_size_field, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This doesn't seem to happen with gcc v11. It looks like the code is
doing the right thing. Is there something we need to fix how the netfs
context gets initialized or is this a compiler problem?

FWIW: I'm using:

gcc (GCC) 12.1.1 20220507 (Red Hat 12.1.1-1)

Thanks,
--
Jeff Layton <jlayton@xxxxxxxxxx>