From: kernel test robot <lkp@intel.com>
To: luoqing <l1138897701@163.com>, agk@redhat.com
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
snitzer@kernel.org, dm-devel@lists.linux.dev,
mpatocka@redhat.com, bmarzins@redhat.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] dm-bufio: Use struct_size() helper in kmalloc()
Date: Fri, 6 Mar 2026 18:14:17 +0100 [thread overview]
Message-ID: <202603061810.Sm9P1QKo-lkp@intel.com> (raw)
In-Reply-To: <20260306080257.1268206-1-l1138897701@163.com>
Hi luoqing,
kernel test robot noticed the following build errors:
[auto build test ERROR on axboe/for-next]
[also build test ERROR on device-mapper-dm/for-next linus/master v7.0-rc2 next-20260306]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/luoqing/dm-bufio-Use-struct_size-helper-in-kmalloc/20260306-165625
base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux.git for-next
patch link: https://lore.kernel.org/r/20260306080257.1268206-1-l1138897701%40163.com
patch subject: [PATCH 2/2] dm-bufio: Use struct_size() helper in kmalloc()
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260306/202603061810.Sm9P1QKo-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260306/202603061810.Sm9P1QKo-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603061810.Sm9P1QKo-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/md/dm-bufio.c:2514:29: error: no member named 'buffer_tree' in 'struct dm_bufio_client'
2514 | c = kzalloc(struct_size(c, buffer_tree, num_locks), GFP_KERNEL);
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:436:37: note: expanded from macro 'struct_size'
436 | sizeof(*(p)) + flex_array_size(p, member, count), \
| ^
include/linux/overflow.h:420:26: note: expanded from macro 'flex_array_size'
420 | (count) * sizeof(*(p)->member) + __must_be_array((p)->member), \
| ^
include/linux/slab.h:1190:52: note: expanded from macro 'kzalloc'
1190 | #define kzalloc(...) alloc_hooks(kzalloc_noprof(__VA_ARGS__))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/alloc_tag.h:265:31: note: expanded from macro 'alloc_hooks'
265 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
include/linux/alloc_tag.h:251:9: note: expanded from macro 'alloc_hooks_tag'
251 | typeof(_do_alloc) _res; \
| ^~~~~~~~~
>> drivers/md/dm-bufio.c:2514:29: error: no member named 'buffer_tree' in 'struct dm_bufio_client'
2514 | c = kzalloc(struct_size(c, buffer_tree, num_locks), GFP_KERNEL);
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:436:37: note: expanded from macro 'struct_size'
436 | sizeof(*(p)) + flex_array_size(p, member, count), \
| ^
include/linux/overflow.h:420:57: note: expanded from macro 'flex_array_size'
420 | (count) * sizeof(*(p)->member) + __must_be_array((p)->member), \
| ^
include/linux/compiler.h:208:64: note: expanded from macro '__must_be_array'
208 | #define __must_be_array(a) __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
| ^
note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/slab.h:1190:52: note: expanded from macro 'kzalloc'
1190 | #define kzalloc(...) alloc_hooks(kzalloc_noprof(__VA_ARGS__))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/alloc_tag.h:265:31: note: expanded from macro 'alloc_hooks'
265 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
include/linux/alloc_tag.h:251:9: note: expanded from macro 'alloc_hooks_tag'
251 | typeof(_do_alloc) _res; \
| ^~~~~~~~~
>> drivers/md/dm-bufio.c:2514:29: error: no member named 'buffer_tree' in 'struct dm_bufio_client'
2514 | c = kzalloc(struct_size(c, buffer_tree, num_locks), GFP_KERNEL);
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:436:37: note: expanded from macro 'struct_size'
436 | sizeof(*(p)) + flex_array_size(p, member, count), \
| ^
include/linux/overflow.h:421:32: note: expanded from macro 'flex_array_size'
421 | size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
| ^
include/linux/slab.h:1190:52: note: expanded from macro 'kzalloc'
1190 | #define kzalloc(...) alloc_hooks(kzalloc_noprof(__VA_ARGS__))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/alloc_tag.h:265:31: note: expanded from macro 'alloc_hooks'
265 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
include/linux/alloc_tag.h:251:9: note: expanded from macro 'alloc_hooks_tag'
251 | typeof(_do_alloc) _res; \
| ^~~~~~~~~
>> drivers/md/dm-bufio.c:2514:29: error: no member named 'buffer_tree' in 'struct dm_bufio_client'
2514 | c = kzalloc(struct_size(c, buffer_tree, num_locks), GFP_KERNEL);
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:436:37: note: expanded from macro 'struct_size'
436 | sizeof(*(p)) + flex_array_size(p, member, count), \
| ^
include/linux/overflow.h:421:63: note: expanded from macro 'flex_array_size'
421 | size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
| ^
include/linux/compiler.h:208:64: note: expanded from macro '__must_be_array'
208 | #define __must_be_array(a) __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
| ^
note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/slab.h:1190:52: note: expanded from macro 'kzalloc'
1190 | #define kzalloc(...) alloc_hooks(kzalloc_noprof(__VA_ARGS__))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/alloc_tag.h:265:31: note: expanded from macro 'alloc_hooks'
265 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
include/linux/alloc_tag.h:251:9: note: expanded from macro 'alloc_hooks_tag'
251 | typeof(_do_alloc) _res; \
| ^~~~~~~~~
>> drivers/md/dm-bufio.c:2514:29: error: no member named 'buffer_tree' in 'struct dm_bufio_client'
2514 | c = kzalloc(struct_size(c, buffer_tree, num_locks), GFP_KERNEL);
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:437:45: note: expanded from macro 'struct_size'
437 | size_add(sizeof(*(p)), flex_array_size(p, member, count)))
| ^
include/linux/overflow.h:420:26: note: expanded from macro 'flex_array_size'
420 | (count) * sizeof(*(p)->member) + __must_be_array((p)->member), \
| ^
include/linux/slab.h:1190:52: note: expanded from macro 'kzalloc'
1190 | #define kzalloc(...) alloc_hooks(kzalloc_noprof(__VA_ARGS__))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/alloc_tag.h:265:31: note: expanded from macro 'alloc_hooks'
265 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
include/linux/alloc_tag.h:251:9: note: expanded from macro 'alloc_hooks_tag'
251 | typeof(_do_alloc) _res; \
| ^~~~~~~~~
>> drivers/md/dm-bufio.c:2514:29: error: no member named 'buffer_tree' in 'struct dm_bufio_client'
2514 | c = kzalloc(struct_size(c, buffer_tree, num_locks), GFP_KERNEL);
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:437:45: note: expanded from macro 'struct_size'
437 | size_add(sizeof(*(p)), flex_array_size(p, member, count)))
| ^
include/linux/overflow.h:420:57: note: expanded from macro 'flex_array_size'
420 | (count) * sizeof(*(p)->member) + __must_be_array((p)->member), \
| ^
include/linux/compiler.h:208:64: note: expanded from macro '__must_be_array'
208 | #define __must_be_array(a) __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
| ^
note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/slab.h:1190:52: note: expanded from macro 'kzalloc'
1190 | #define kzalloc(...) alloc_hooks(kzalloc_noprof(__VA_ARGS__))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/alloc_tag.h:265:31: note: expanded from macro 'alloc_hooks'
265 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
include/linux/alloc_tag.h:251:9: note: expanded from macro 'alloc_hooks_tag'
251 | typeof(_do_alloc) _res; \
| ^~~~~~~~~
>> drivers/md/dm-bufio.c:2514:29: error: no member named 'buffer_tree' in 'struct dm_bufio_client'
2514 | c = kzalloc(struct_size(c, buffer_tree, num_locks), GFP_KERNEL);
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:437:45: note: expanded from macro 'struct_size'
437 | size_add(sizeof(*(p)), flex_array_size(p, member, count)))
| ^
include/linux/overflow.h:421:32: note: expanded from macro 'flex_array_size'
421 | size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
| ^
include/linux/slab.h:1190:52: note: expanded from macro 'kzalloc'
1190 | #define kzalloc(...) alloc_hooks(kzalloc_noprof(__VA_ARGS__))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/alloc_tag.h:265:31: note: expanded from macro 'alloc_hooks'
265 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
include/linux/alloc_tag.h:251:9: note: expanded from macro 'alloc_hooks_tag'
251 | typeof(_do_alloc) _res; \
| ^~~~~~~~~
>> drivers/md/dm-bufio.c:2514:29: error: no member named 'buffer_tree' in 'struct dm_bufio_client'
2514 | c = kzalloc(struct_size(c, buffer_tree, num_locks), GFP_KERNEL);
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:437:45: note: expanded from macro 'struct_size'
437 | size_add(sizeof(*(p)), flex_array_size(p, member, count)))
| ^
include/linux/overflow.h:421:63: note: expanded from macro 'flex_array_size'
421 | size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
| ^
include/linux/compiler.h:208:64: note: expanded from macro '__must_be_array'
208 | #define __must_be_array(a) __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
| ^
note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/slab.h:1190:52: note: expanded from macro 'kzalloc'
1190 | #define kzalloc(...) alloc_hooks(kzalloc_noprof(__VA_ARGS__))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/alloc_tag.h:265:31: note: expanded from macro 'alloc_hooks'
265 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
include/linux/alloc_tag.h:251:9: note: expanded from macro 'alloc_hooks_tag'
251 | typeof(_do_alloc) _res; \
| ^~~~~~~~~
>> drivers/md/dm-bufio.c:2514:29: error: no member named 'buffer_tree' in 'struct dm_bufio_client'
2514 | c = kzalloc(struct_size(c, buffer_tree, num_locks), GFP_KERNEL);
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:436:37: note: expanded from macro 'struct_size'
436 | sizeof(*(p)) + flex_array_size(p, member, count), \
| ^
include/linux/overflow.h:420:26: note: expanded from macro 'flex_array_size'
420 | (count) * sizeof(*(p)->member) + __must_be_array((p)->member), \
| ^
include/linux/slab.h:1190:52: note: expanded from macro 'kzalloc'
1190 | #define kzalloc(...) alloc_hooks(kzalloc_noprof(__VA_ARGS__))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/alloc_tag.h:265:31: note: expanded from macro 'alloc_hooks'
265 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
include/linux/alloc_tag.h:255:10: note: expanded from macro 'alloc_hooks_tag'
255 | _res = _do_alloc; \
| ^~~~~~~~~
>> drivers/md/dm-bufio.c:2514:29: error: no member named 'buffer_tree' in 'struct dm_bufio_client'
2514 | c = kzalloc(struct_size(c, buffer_tree, num_locks), GFP_KERNEL);
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:436:37: note: expanded from macro 'struct_size'
436 | sizeof(*(p)) + flex_array_size(p, member, count), \
| ^
include/linux/overflow.h:420:57: note: expanded from macro 'flex_array_size'
420 | (count) * sizeof(*(p)->member) + __must_be_array((p)->member), \
| ^
include/linux/compiler.h:208:64: note: expanded from macro '__must_be_array'
208 | #define __must_be_array(a) __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
| ^
note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/slab.h:1190:52: note: expanded from macro 'kzalloc'
1190 | #define kzalloc(...) alloc_hooks(kzalloc_noprof(__VA_ARGS__))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/alloc_tag.h:265:31: note: expanded from macro 'alloc_hooks'
265 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
include/linux/alloc_tag.h:255:10: note: expanded from macro 'alloc_hooks_tag'
255 | _res = _do_alloc; \
| ^~~~~~~~~
>> drivers/md/dm-bufio.c:2514:29: error: no member named 'buffer_tree' in 'struct dm_bufio_client'
2514 | c = kzalloc(struct_size(c, buffer_tree, num_locks), GFP_KERNEL);
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:436:37: note: expanded from macro 'struct_size'
436 | sizeof(*(p)) + flex_array_size(p, member, count), \
| ^
include/linux/overflow.h:421:32: note: expanded from macro 'flex_array_size'
421 | size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
| ^
include/linux/slab.h:1190:52: note: expanded from macro 'kzalloc'
1190 | #define kzalloc(...) alloc_hooks(kzalloc_noprof(__VA_ARGS__))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/alloc_tag.h:265:31: note: expanded from macro 'alloc_hooks'
265 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
include/linux/alloc_tag.h:255:10: note: expanded from macro 'alloc_hooks_tag'
255 | _res = _do_alloc; \
| ^~~~~~~~~
>> drivers/md/dm-bufio.c:2514:29: error: no member named 'buffer_tree' in 'struct dm_bufio_client'
2514 | c = kzalloc(struct_size(c, buffer_tree, num_locks), GFP_KERNEL);
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:436:37: note: expanded from macro 'struct_size'
436 | sizeof(*(p)) + flex_array_size(p, member, count), \
| ^
include/linux/overflow.h:421:63: note: expanded from macro 'flex_array_size'
421 | size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
| ^
include/linux/compiler.h:208:64: note: expanded from macro '__must_be_array'
208 | #define __must_be_array(a) __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
| ^
note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/slab.h:1190:52: note: expanded from macro 'kzalloc'
1190 | #define kzalloc(...) alloc_hooks(kzalloc_noprof(__VA_ARGS__))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/alloc_tag.h:265:31: note: expanded from macro 'alloc_hooks'
265 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
include/linux/alloc_tag.h:255:10: note: expanded from macro 'alloc_hooks_tag'
255 | _res = _do_alloc; \
| ^~~~~~~~~
>> drivers/md/dm-bufio.c:2514:29: error: no member named 'buffer_tree' in 'struct dm_bufio_client'
2514 | c = kzalloc(struct_size(c, buffer_tree, num_locks), GFP_KERNEL);
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:437:45: note: expanded from macro 'struct_size'
437 | size_add(sizeof(*(p)), flex_array_size(p, member, count)))
| ^
include/linux/overflow.h:420:26: note: expanded from macro 'flex_array_size'
420 | (count) * sizeof(*(p)->member) + __must_be_array((p)->member), \
| ^
include/linux/slab.h:1190:52: note: expanded from macro 'kzalloc'
1190 | #define kzalloc(...) alloc_hooks(kzalloc_noprof(__VA_ARGS__))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/alloc_tag.h:265:31: note: expanded from macro 'alloc_hooks'
265 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
include/linux/alloc_tag.h:255:10: note: expanded from macro 'alloc_hooks_tag'
255 | _res = _do_alloc; \
| ^~~~~~~~~
>> drivers/md/dm-bufio.c:2514:29: error: no member named 'buffer_tree' in 'struct dm_bufio_client'
2514 | c = kzalloc(struct_size(c, buffer_tree, num_locks), GFP_KERNEL);
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:437:45: note: expanded from macro 'struct_size'
437 | size_add(sizeof(*(p)), flex_array_size(p, member, count)))
| ^
include/linux/overflow.h:420:57: note: expanded from macro 'flex_array_size'
420 | (count) * sizeof(*(p)->member) + __must_be_array((p)->member), \
| ^
include/linux/compiler.h:208:64: note: expanded from macro '__must_be_array'
208 | #define __must_be_array(a) __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
| ^
note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/slab.h:1190:52: note: expanded from macro 'kzalloc'
1190 | #define kzalloc(...) alloc_hooks(kzalloc_noprof(__VA_ARGS__))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/alloc_tag.h:265:31: note: expanded from macro 'alloc_hooks'
265 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
include/linux/alloc_tag.h:255:10: note: expanded from macro 'alloc_hooks_tag'
255 | _res = _do_alloc; \
| ^~~~~~~~~
>> drivers/md/dm-bufio.c:2514:29: error: no member named 'buffer_tree' in 'struct dm_bufio_client'
2514 | c = kzalloc(struct_size(c, buffer_tree, num_locks), GFP_KERNEL);
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:437:45: note: expanded from macro 'struct_size'
437 | size_add(sizeof(*(p)), flex_array_size(p, member, count)))
| ^
include/linux/overflow.h:421:32: note: expanded from macro 'flex_array_size'
421 | size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
| ^
include/linux/slab.h:1190:52: note: expanded from macro 'kzalloc'
1190 | #define kzalloc(...) alloc_hooks(kzalloc_noprof(__VA_ARGS__))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/alloc_tag.h:265:31: note: expanded from macro 'alloc_hooks'
265 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
include/linux/alloc_tag.h:255:10: note: expanded from macro 'alloc_hooks_tag'
255 | _res = _do_alloc; \
| ^~~~~~~~~
>> drivers/md/dm-bufio.c:2514:29: error: no member named 'buffer_tree' in 'struct dm_bufio_client'
2514 | c = kzalloc(struct_size(c, buffer_tree, num_locks), GFP_KERNEL);
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:437:45: note: expanded from macro 'struct_size'
437 | size_add(sizeof(*(p)), flex_array_size(p, member, count)))
| ^
include/linux/overflow.h:421:63: note: expanded from macro 'flex_array_size'
421 | size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
| ^
include/linux/compiler.h:208:64: note: expanded from macro '__must_be_array'
208 | #define __must_be_array(a) __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
| ^
note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/slab.h:1190:52: note: expanded from macro 'kzalloc'
1190 | #define kzalloc(...) alloc_hooks(kzalloc_noprof(__VA_ARGS__))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/alloc_tag.h:265:31: note: expanded from macro 'alloc_hooks'
265 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
include/linux/alloc_tag.h:255:10: note: expanded from macro 'alloc_hooks_tag'
255 | _res = _do_alloc; \
| ^~~~~~~~~
>> drivers/md/dm-bufio.c:2514:29: error: no member named 'buffer_tree' in 'struct dm_bufio_client'
2514 | c = kzalloc(struct_size(c, buffer_tree, num_locks), GFP_KERNEL);
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:436:37: note: expanded from macro 'struct_size'
436 | sizeof(*(p)) + flex_array_size(p, member, count), \
| ^
include/linux/overflow.h:420:26: note: expanded from macro 'flex_array_size'
420 | (count) * sizeof(*(p)->member) + __must_be_array((p)->member), \
| ^
include/linux/slab.h:1190:52: note: expanded from macro 'kzalloc'
1190 | #define kzalloc(...) alloc_hooks(kzalloc_noprof(__VA_ARGS__))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/alloc_tag.h:265:31: note: expanded from macro 'alloc_hooks'
265 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
include/linux/alloc_tag.h:258:10: note: expanded from macro 'alloc_hooks_tag'
258 | _res = _do_alloc; \
| ^~~~~~~~~
>> drivers/md/dm-bufio.c:2514:29: error: no member named 'buffer_tree' in 'struct dm_bufio_client'
2514 | c = kzalloc(struct_size(c, buffer_tree, num_locks), GFP_KERNEL);
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:436:37: note: expanded from macro 'struct_size'
436 | sizeof(*(p)) + flex_array_size(p, member, count), \
| ^
include/linux/overflow.h:420:57: note: expanded from macro 'flex_array_size'
420 | (count) * sizeof(*(p)->member) + __must_be_array((p)->member), \
| ^
include/linux/compiler.h:208:64: note: expanded from macro '__must_be_array'
208 | #define __must_be_array(a) __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
| ^
note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/slab.h:1190:52: note: expanded from macro 'kzalloc'
1190 | #define kzalloc(...) alloc_hooks(kzalloc_noprof(__VA_ARGS__))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/alloc_tag.h:265:31: note: expanded from macro 'alloc_hooks'
265 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
include/linux/alloc_tag.h:258:10: note: expanded from macro 'alloc_hooks_tag'
258 | _res = _do_alloc; \
| ^~~~~~~~~
>> drivers/md/dm-bufio.c:2514:29: error: no member named 'buffer_tree' in 'struct dm_bufio_client'
2514 | c = kzalloc(struct_size(c, buffer_tree, num_locks), GFP_KERNEL);
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:436:37: note: expanded from macro 'struct_size'
436 | sizeof(*(p)) + flex_array_size(p, member, count), \
| ^
include/linux/overflow.h:421:32: note: expanded from macro 'flex_array_size'
421 | size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
| ^
include/linux/slab.h:1190:52: note: expanded from macro 'kzalloc'
1190 | #define kzalloc(...) alloc_hooks(kzalloc_noprof(__VA_ARGS__))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/alloc_tag.h:265:31: note: expanded from macro 'alloc_hooks'
265 | alloc_hooks_tag(&_alloc_tag, _do_alloc); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
include/linux/alloc_tag.h:258:10: note: expanded from macro 'alloc_hooks_tag'
258 | _res = _do_alloc; \
| ^~~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
vim +2514 drivers/md/dm-bufio.c
2491
2492 /*
2493 * Create the buffering interface
2494 */
2495 struct dm_bufio_client *dm_bufio_client_create(struct block_device *bdev, unsigned int block_size,
2496 unsigned int reserved_buffers, unsigned int aux_size,
2497 void (*alloc_callback)(struct dm_buffer *),
2498 void (*write_callback)(struct dm_buffer *),
2499 unsigned int flags)
2500 {
2501 int r;
2502 unsigned int num_locks;
2503 struct dm_bufio_client *c;
2504 char slab_name[64];
2505 static atomic_t seqno = ATOMIC_INIT(0);
2506
2507 if (!block_size || block_size & ((1 << SECTOR_SHIFT) - 1)) {
2508 DMERR("%s: block size not specified or is not multiple of 512b", __func__);
2509 r = -EINVAL;
2510 goto bad_client;
2511 }
2512
2513 num_locks = dm_num_hash_locks();
> 2514 c = kzalloc(struct_size(c, buffer_tree, num_locks), GFP_KERNEL);
2515 if (!c) {
2516 r = -ENOMEM;
2517 goto bad_client;
2518 }
2519 cache_init(&c->cache, num_locks, (flags & DM_BUFIO_CLIENT_NO_SLEEP) != 0);
2520
2521 c->bdev = bdev;
2522 c->block_size = block_size;
2523 if (is_power_of_2(block_size))
2524 c->sectors_per_block_bits = __ffs(block_size) - SECTOR_SHIFT;
2525 else
2526 c->sectors_per_block_bits = -1;
2527
2528 c->alloc_callback = alloc_callback;
2529 c->write_callback = write_callback;
2530
2531 if (flags & DM_BUFIO_CLIENT_NO_SLEEP) {
2532 c->no_sleep = true;
2533 static_branch_inc(&no_sleep_enabled);
2534 }
2535
2536 mutex_init(&c->lock);
2537 spin_lock_init(&c->spinlock);
2538 INIT_LIST_HEAD(&c->reserved_buffers);
2539 c->need_reserved_buffers = reserved_buffers;
2540
2541 dm_bufio_set_minimum_buffers(c, DM_BUFIO_MIN_BUFFERS);
2542
2543 init_waitqueue_head(&c->free_buffer_wait);
2544 c->async_write_error = 0;
2545
2546 c->dm_io = dm_io_client_create();
2547 if (IS_ERR(c->dm_io)) {
2548 r = PTR_ERR(c->dm_io);
2549 goto bad_dm_io;
2550 }
2551
2552 if (block_size <= KMALLOC_MAX_SIZE && !is_power_of_2(block_size)) {
2553 unsigned int align = min(1U << __ffs(block_size), (unsigned int)PAGE_SIZE);
2554
2555 snprintf(slab_name, sizeof(slab_name), "dm_bufio_cache-%u-%u",
2556 block_size, atomic_inc_return(&seqno));
2557 c->slab_cache = kmem_cache_create(slab_name, block_size, align,
2558 SLAB_RECLAIM_ACCOUNT, NULL);
2559 if (!c->slab_cache) {
2560 r = -ENOMEM;
2561 goto bad;
2562 }
2563 }
2564 if (aux_size)
2565 snprintf(slab_name, sizeof(slab_name), "dm_bufio_buffer-%u-%u",
2566 aux_size, atomic_inc_return(&seqno));
2567 else
2568 snprintf(slab_name, sizeof(slab_name), "dm_bufio_buffer-%u",
2569 atomic_inc_return(&seqno));
2570 c->slab_buffer = kmem_cache_create(slab_name, sizeof(struct dm_buffer) + aux_size,
2571 0, SLAB_RECLAIM_ACCOUNT, NULL);
2572 if (!c->slab_buffer) {
2573 r = -ENOMEM;
2574 goto bad;
2575 }
2576
2577 while (c->need_reserved_buffers) {
2578 struct dm_buffer *b = alloc_buffer(c, GFP_KERNEL);
2579
2580 if (!b) {
2581 r = -ENOMEM;
2582 goto bad;
2583 }
2584 __free_buffer_wake(b);
2585 }
2586
2587 INIT_WORK(&c->shrink_work, shrink_work);
2588 atomic_long_set(&c->need_shrink, 0);
2589
2590 c->shrinker = shrinker_alloc(0, "dm-bufio:(%u:%u)",
2591 MAJOR(bdev->bd_dev), MINOR(bdev->bd_dev));
2592 if (!c->shrinker) {
2593 r = -ENOMEM;
2594 goto bad;
2595 }
2596
2597 c->shrinker->count_objects = dm_bufio_shrink_count;
2598 c->shrinker->scan_objects = dm_bufio_shrink_scan;
2599 c->shrinker->seeks = 1;
2600 c->shrinker->batch = 0;
2601 c->shrinker->private_data = c;
2602
2603 shrinker_register(c->shrinker);
2604
2605 mutex_lock(&dm_bufio_clients_lock);
2606 dm_bufio_client_count++;
2607 list_add(&c->client_list, &dm_bufio_all_clients);
2608 __cache_size_refresh();
2609 mutex_unlock(&dm_bufio_clients_lock);
2610
2611 return c;
2612
2613 bad:
2614 while (!list_empty(&c->reserved_buffers)) {
2615 struct dm_buffer *b = list_to_buffer(c->reserved_buffers.next);
2616
2617 list_del(&b->lru.list);
2618 free_buffer(b);
2619 }
2620 kmem_cache_destroy(c->slab_cache);
2621 kmem_cache_destroy(c->slab_buffer);
2622 dm_io_client_destroy(c->dm_io);
2623 bad_dm_io:
2624 mutex_destroy(&c->lock);
2625 if (c->no_sleep)
2626 static_branch_dec(&no_sleep_enabled);
2627 kfree(c);
2628 bad_client:
2629 return ERR_PTR(r);
2630 }
2631 EXPORT_SYMBOL_GPL(dm_bufio_client_create);
2632
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next prev parent reply other threads:[~2026-03-06 17:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-06 8:02 [PATCH 2/2] dm-bufio: Use struct_size() helper in kmalloc() luoqing
2026-03-06 17:14 ` kernel test robot [this message]
2026-03-06 19:07 ` kernel test robot
2026-03-06 23:47 ` Benjamin Marzinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202603061810.Sm9P1QKo-lkp@intel.com \
--to=lkp@intel.com \
--cc=agk@redhat.com \
--cc=bmarzins@redhat.com \
--cc=dm-devel@lists.linux.dev \
--cc=l1138897701@163.com \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=mpatocka@redhat.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=snitzer@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.