* [hch-block:blkdev.h-includes 1/17] lib/random32.c:578:9: error: implicit declaration of function 'kmalloc'
@ 2021-09-06 19:55 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-09-06 19:55 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 6956 bytes --]
tree: git://git.infradead.org/users/hch/block.git blkdev.h-includes
head: 9a8385d2d0ea7e589b98c102f4a60576385ca6c7
commit: da3770fc4eb333d0132df546e4fa0d3467654a74 [1/17] mm: don't include <linux/blk-cgroup.h> in <linux/writeback.h>
config: i386-randconfig-a013-20210906 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 6fe2beba7d2a41964af658c8c59dd172683ef739)
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
git remote add hch-block git://git.infradead.org/users/hch/block.git
git fetch --no-tags hch-block blkdev.h-includes
git checkout da3770fc4eb333d0132df546e4fa0d3467654a74
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
>> lib/random32.c:578:9: error: implicit declaration of function 'kmalloc' [-Werror,-Wimplicit-function-declaration]
data = kmalloc(sizeof(*data) * TEST_SIZE, GFP_KERNEL);
^
lib/random32.c:578:9: note: did you mean 'kvmalloc'?
include/linux/mm.h:803:21: note: 'kvmalloc' declared here
static inline void *kvmalloc(size_t size, gfp_t flags)
^
>> lib/random32.c:578:7: error: incompatible integer to pointer conversion assigning to 'u32 *' (aka 'unsigned int *') from 'int' [-Werror,-Wint-conversion]
data = kmalloc(sizeof(*data) * TEST_SIZE, GFP_KERNEL);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> lib/random32.c:609:2: error: implicit declaration of function 'kfree' [-Werror,-Wimplicit-function-declaration]
kfree(data);
^
lib/random32.c:609:2: note: did you mean 'kvfree'?
include/linux/mm.h:833:13: note: 'kvfree' declared here
extern void kvfree(const void *addr);
^
3 errors generated.
vim +/kmalloc +578 lib/random32.c
c51f8f88d705e0 George Spelvin 2020-08-09 559
c6e169bc146a76 Willy Tarreau 2020-10-24 560 #ifdef CONFIG_RANDOM32_SELFTEST
c6e169bc146a76 Willy Tarreau 2020-10-24 561 /* Principle: True 32-bit random numbers will all have 16 differing bits on
c6e169bc146a76 Willy Tarreau 2020-10-24 562 * average. For each 32-bit number, there are 601M numbers differing by 16
c6e169bc146a76 Willy Tarreau 2020-10-24 563 * bits, and 89% of the numbers differ by at least 12 bits. Note that more
c6e169bc146a76 Willy Tarreau 2020-10-24 564 * than 16 differing bits also implies a correlation with inverted bits. Thus
c6e169bc146a76 Willy Tarreau 2020-10-24 565 * we take 1024 random numbers and compare each of them to the other ones,
c6e169bc146a76 Willy Tarreau 2020-10-24 566 * counting the deviation of correlated bits to 16. Constants report 32,
c6e169bc146a76 Willy Tarreau 2020-10-24 567 * counters 32-log2(TEST_SIZE), and pure randoms, around 6 or lower. With the
c6e169bc146a76 Willy Tarreau 2020-10-24 568 * u32 total, TEST_SIZE may be as large as 4096 samples.
c6e169bc146a76 Willy Tarreau 2020-10-24 569 */
c6e169bc146a76 Willy Tarreau 2020-10-24 570 #define TEST_SIZE 1024
c6e169bc146a76 Willy Tarreau 2020-10-24 571 static int __init prandom32_state_selftest(void)
c6e169bc146a76 Willy Tarreau 2020-10-24 572 {
c6e169bc146a76 Willy Tarreau 2020-10-24 573 unsigned int x, y, bits, samples;
c6e169bc146a76 Willy Tarreau 2020-10-24 574 u32 xor, flip;
c6e169bc146a76 Willy Tarreau 2020-10-24 575 u32 total;
c6e169bc146a76 Willy Tarreau 2020-10-24 576 u32 *data;
c6e169bc146a76 Willy Tarreau 2020-10-24 577
c6e169bc146a76 Willy Tarreau 2020-10-24 @578 data = kmalloc(sizeof(*data) * TEST_SIZE, GFP_KERNEL);
c6e169bc146a76 Willy Tarreau 2020-10-24 579 if (!data)
c6e169bc146a76 Willy Tarreau 2020-10-24 580 return 0;
c6e169bc146a76 Willy Tarreau 2020-10-24 581
c6e169bc146a76 Willy Tarreau 2020-10-24 582 for (samples = 0; samples < TEST_SIZE; samples++)
c6e169bc146a76 Willy Tarreau 2020-10-24 583 data[samples] = prandom_u32();
c6e169bc146a76 Willy Tarreau 2020-10-24 584
c6e169bc146a76 Willy Tarreau 2020-10-24 585 flip = total = 0;
c6e169bc146a76 Willy Tarreau 2020-10-24 586 for (x = 0; x < samples; x++) {
c6e169bc146a76 Willy Tarreau 2020-10-24 587 for (y = 0; y < samples; y++) {
c6e169bc146a76 Willy Tarreau 2020-10-24 588 if (x == y)
c6e169bc146a76 Willy Tarreau 2020-10-24 589 continue;
c6e169bc146a76 Willy Tarreau 2020-10-24 590 xor = data[x] ^ data[y];
c6e169bc146a76 Willy Tarreau 2020-10-24 591 flip |= xor;
c6e169bc146a76 Willy Tarreau 2020-10-24 592 bits = hweight32(xor);
c6e169bc146a76 Willy Tarreau 2020-10-24 593 total += (bits - 16) * (bits - 16);
c6e169bc146a76 Willy Tarreau 2020-10-24 594 }
c6e169bc146a76 Willy Tarreau 2020-10-24 595 }
c6e169bc146a76 Willy Tarreau 2020-10-24 596
c6e169bc146a76 Willy Tarreau 2020-10-24 597 /* We'll return the average deviation as 2*sqrt(corr/samples), which
c6e169bc146a76 Willy Tarreau 2020-10-24 598 * is also sqrt(4*corr/samples) which provides a better resolution.
c6e169bc146a76 Willy Tarreau 2020-10-24 599 */
c6e169bc146a76 Willy Tarreau 2020-10-24 600 bits = int_sqrt(total / (samples * (samples - 1)) * 4);
c6e169bc146a76 Willy Tarreau 2020-10-24 601 if (bits > 6)
c6e169bc146a76 Willy Tarreau 2020-10-24 602 pr_warn("prandom32: self test failed (at least %u bits"
c6e169bc146a76 Willy Tarreau 2020-10-24 603 " correlated, fixed_mask=%#x fixed_value=%#x\n",
c6e169bc146a76 Willy Tarreau 2020-10-24 604 bits, ~flip, data[0] & ~flip);
c6e169bc146a76 Willy Tarreau 2020-10-24 605 else
c6e169bc146a76 Willy Tarreau 2020-10-24 606 pr_info("prandom32: self test passed (less than %u bits"
c6e169bc146a76 Willy Tarreau 2020-10-24 607 " correlated)\n",
c6e169bc146a76 Willy Tarreau 2020-10-24 608 bits+1);
c6e169bc146a76 Willy Tarreau 2020-10-24 @609 kfree(data);
c6e169bc146a76 Willy Tarreau 2020-10-24 610 return 0;
c6e169bc146a76 Willy Tarreau 2020-10-24 611 }
c6e169bc146a76 Willy Tarreau 2020-10-24 612 core_initcall(prandom32_state_selftest);
c6e169bc146a76 Willy Tarreau 2020-10-24 613 #endif /* CONFIG_RANDOM32_SELFTEST */
c6e169bc146a76 Willy Tarreau 2020-10-24 614
:::::: The code at line 578 was first introduced by commit
:::::: c6e169bc146a76d5ccbf4d3825f705414352bd03 random32: add a selftest for the prandom32 code
:::::: TO: Willy Tarreau <w@1wt.eu>
:::::: CC: Willy Tarreau <w@1wt.eu>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 36878 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-09-06 19:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-06 19:55 [hch-block:blkdev.h-includes 1/17] lib/random32.c:578:9: error: implicit declaration of function 'kmalloc' kernel test robot
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.