Re: [PATCH v24 12/12] LRNG - add interface for gathering of raw entropy

From: Stephan Müller
Date: Tue Nov 12 2019 - 18:14:22 EST


Am Dienstag, 12. November 2019, 21:55:10 CET schrieb kbuild test robot:

Hi kbuild,

> Hi "Stephan,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on char-misc/char-misc-testing]
> [also build test WARNING on v5.4-rc7 next-20191111]
> [if your patch is applied to the wrong git tree, please drop us a note to
> help improve the system. BTW, we also suggest to use '--base' option to
> specify the base tree in git format-patch, please see
> https://stackoverflow.com/a/37406982]
>
> url:
> https://github.com/0day-ci/linux/commits/Stephan-M-ller/dev-random-a-new-ap
> proach-with-full-SP800-90B-compliance/20191113-040847 base:
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
> 01b59c763fe2de845b65900485b141fdd7bbf93e config: sh-allmodconfig (attached
> as .config)
> compiler: sh4-linux-gcc (GCC) 7.4.0
> reproduce:
> wget
> https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
> ~/bin/make.cross chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> GCC_VERSION=7.4.0 make.cross ARCH=sh
>
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@xxxxxxxxx>
>
> All warnings (new ones prefixed by >>):
>
> drivers/char/lrng/lrng_testing.c: In function 'lrng_raw_extract_user':
> >> drivers/char/lrng/lrng_testing.c:237:1: warning: the frame size of 1076
> >> bytes is larger than 1024 bytes [-Wframe-larger-than=]
> }
> ^
>
> vim +237 drivers/char/lrng/lrng_testing.c
>
> 196
>
> 197 /**********************************************************************
> **** 198 * Debugfs interface
> 199
> **************************************************************************/
> 200 static int lrng_raw_extract_user(void __user *buf, size_t nbytes) 201 {
> 202 u8 tmp[LRNG_TESTING_RINGBUFFER_SIZE]
__aligned(sizeof(u32));

This is the offending line.

I will need to kzalloc the code here.

Thank you.

> 203 int ret = 0, large_request = (nbytes > 256);
> 204
> 205 while (nbytes) {
> 206 int i;
> 207
> 208 if (large_request && need_resched()) {
> 209 if (signal_pending(current)) {
> 210 if (ret == 0)
> 211 ret = -ERESTARTSYS;
> 212 break;
> 213 }
> 214 schedule();
> 215 }
> 216
> 217 i = min_t(int, nbytes, sizeof(tmp));
> 218 i = lrng_raw_entropy_reader(tmp, i);
> 219 if (i <= 0) {
> 220 if (i < 0)
> 221 ret = i;
> 222 break;
> 223 }
> 224 if (copy_to_user(buf, tmp, i)) {
> 225 ret = -EFAULT;
> 226 break;
> 227 }
> 228
> 229 nbytes -= i;
> 230 buf = (u8 *)buf + i;
> 231 ret += i;
> 232 }
> 233
> 234 memzero_explicit(tmp, sizeof(tmp));
> 235
> 236 return ret;
>
> > 237 }
>
> 238
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology
> Center https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx Intel
> Corporation


Ciao
Stephan