mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* lib/memcpy_kunit.c:299 init_large() warn: calling memset(x, y, ARRAY_SIZE());
@ 2023-01-03  7:58 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2023-01-03  7:58 UTC (permalink / raw)
  To: oe-kbuild, Kees Cook; +Cc: lkp, oe-kbuild-all, linux-kernel

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   c8451c141e07a8d05693f6c8d0e418fbb4b68bb7
commit: 96fce387d58fa8eae6e8d9b1ecdfbc18292d7a68 kunit/memcpy: Add dynamic size and window tests
config: ia64-randconfig-m031-20221229
compiler: ia64-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>

smatch warnings:
lib/memcpy_kunit.c:299 init_large() warn: calling memset(x, y, ARRAY_SIZE());

vim +299 lib/memcpy_kunit.c

96fce387d58fa8 Kees Cook 2022-09-28  290  
96fce387d58fa8 Kees Cook 2022-09-28  291  	/* Get many bit patterns. */
96fce387d58fa8 Kees Cook 2022-09-28  292  	get_random_bytes(large_src, ARRAY_SIZE(large_src));
                                                                            ^^^^^^^^^^^^^^^^^^^^^

96fce387d58fa8 Kees Cook 2022-09-28  293  
96fce387d58fa8 Kees Cook 2022-09-28  294  	/* Make sure we have non-zero edges. */
96fce387d58fa8 Kees Cook 2022-09-28  295  	set_random_nonzero(test, &large_src[0]);
96fce387d58fa8 Kees Cook 2022-09-28  296  	set_random_nonzero(test, &large_src[ARRAY_SIZE(large_src) - 1]);
96fce387d58fa8 Kees Cook 2022-09-28  297  
96fce387d58fa8 Kees Cook 2022-09-28  298  	/* Explicitly zero the entire destination. */
96fce387d58fa8 Kees Cook 2022-09-28 @299  	memset(large_dst, 0, ARRAY_SIZE(large_dst));

ARRAY_SIZE() is the number of elements.  You want sizeof().  My guess is
that probably large_dst has the 1 byte elements, but you know...

96fce387d58fa8 Kees Cook 2022-09-28  300  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-03  7:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-03  7:58 lib/memcpy_kunit.c:299 init_large() warn: calling memset(x, y, ARRAY_SIZE()); Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®