Re: [PATCH] NFSD: prevent integer overflow on 32 bit systems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 15, 2022 at 03:57:36AM +0800, kernel test robot wrote:
>    In file included from net/ipv4/ipconfig.c:59:
>    In file included from include/linux/nfs_fs.h:31:
>    In file included from include/linux/sunrpc/auth.h:13:
>    In file included from include/linux/sunrpc/sched.h:19:
> >> include/linux/sunrpc/xdr.h:734:10: warning: result of comparison of constant 4611686018427387903 with expression of type '__u32' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
>            if (len > ULONG_MAX / sizeof(*p))
>                ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~

Smatch also wanted to send this warning.  I am testing a fix to silence
this warning in Smatch.  It looks for an some_int > some_expression
where some_expression has ULONG_MAX on the far left hand side of the
binop.  Because the some_expression always starts with ULONG_MAX and
then divides it and/or subtracts from it to get the max.

regards,
dan carpenter




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux