[gustavoars:testing/wfamnae-next20250124 14/15] include/linux/container_of.h:19:15: warning: 'fnode' is used uninitialized

From: kernel test robot
Date: Mon Jan 27 2025 - 08:32:12 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git testing/wfamnae-next20250124
head: 86b653e4edef7b0f7b7afe5dd8e0241fc1165238
commit: f66219294267a2fba220f4f3118e11c5cda63d0b [14/15] fs: hpfs: Avoid multiple -Wflex-array-member-not-at-end warnings
config: arm64-randconfig-001-20250127 (https://download.01.org/0day-ci/archive/20250127/202501272144.yqyXsRII-lkp@xxxxxxxxx/config)
compiler: aarch64-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250127/202501272144.yqyXsRII-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501272144.yqyXsRII-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

In file included from include/linux/list.h:5,
from include/linux/mutex.h:15,
from fs/hpfs/hpfs_fn.h:18,
from fs/hpfs/anode.c:10:
fs/hpfs/anode.c: In function 'hpfs_add_sector_to_btree':
>> include/linux/container_of.h:19:15: warning: 'fnode' is used uninitialized [-Wuninitialized]
19 | void *__mptr = (void *)(ptr); \
| ^~~~~~
fs/hpfs/anode.c:74:44: note: in expansion of macro 'container_of'
74 | struct bplus_header *fnode_btree = container_of(&fnode->btree, struct bplus_header, __hdr);
| ^~~~~~~~~~~~
fs/hpfs/anode.c:65:23: note: 'fnode' was declared here
65 | struct fnode *fnode;
| ^~~~~


vim +/fnode +19 include/linux/container_of.h

d2a8ebbf8192b8 Andy Shevchenko 2021-11-08 9
d2a8ebbf8192b8 Andy Shevchenko 2021-11-08 10 /**
d2a8ebbf8192b8 Andy Shevchenko 2021-11-08 11 * container_of - cast a member of a structure out to the containing structure
d2a8ebbf8192b8 Andy Shevchenko 2021-11-08 12 * @ptr: the pointer to the member.
d2a8ebbf8192b8 Andy Shevchenko 2021-11-08 13 * @type: the type of the container struct this is embedded in.
d2a8ebbf8192b8 Andy Shevchenko 2021-11-08 14 * @member: the name of the member within the struct.
d2a8ebbf8192b8 Andy Shevchenko 2021-11-08 15 *
7376e561fd2e01 Sakari Ailus 2022-10-24 16 * WARNING: any const qualifier of @ptr is lost.
d2a8ebbf8192b8 Andy Shevchenko 2021-11-08 17 */
d2a8ebbf8192b8 Andy Shevchenko 2021-11-08 18 #define container_of(ptr, type, member) ({ \
d2a8ebbf8192b8 Andy Shevchenko 2021-11-08 @19 void *__mptr = (void *)(ptr); \
e1edc277e6f6df Rasmus Villemoes 2021-11-08 20 static_assert(__same_type(*(ptr), ((type *)0)->member) || \
e1edc277e6f6df Rasmus Villemoes 2021-11-08 21 __same_type(*(ptr), void), \
d2a8ebbf8192b8 Andy Shevchenko 2021-11-08 22 "pointer type mismatch in container_of()"); \
d2a8ebbf8192b8 Andy Shevchenko 2021-11-08 23 ((type *)(__mptr - offsetof(type, member))); })
d2a8ebbf8192b8 Andy Shevchenko 2021-11-08 24

:::::: The code at line 19 was first introduced by commit
:::::: d2a8ebbf8192b84b11f1b204c4f7c602df32aeac kernel.h: split out container_of() and typeof_member() macros

:::::: TO: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki