SUNRPC: Silence compiler complaints about tautological comparisons
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Wed, 13 Sep 2023 20:12:33 +0000 (16:12 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Fri, 15 Sep 2023 19:50:39 +0000 (15:50 -0400)
On 64-bit systems, the compiler will complain that the comparison
between SIZE_MAX and the 32-bit unsigned int 'len' is unnecessary.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
include/linux/sunrpc/xdr.h

index 896a6d2..2f8dc47 100644 (file)
@@ -779,7 +779,7 @@ xdr_stream_decode_uint32_array(struct xdr_stream *xdr,
 
        if (unlikely(xdr_stream_decode_u32(xdr, &len) < 0))
                return -EBADMSG;
-       if (len > SIZE_MAX / sizeof(*p))
+       if (U32_MAX >= SIZE_MAX / sizeof(*p) && len > SIZE_MAX / sizeof(*p))
                return -EBADMSG;
        p = xdr_inline_decode(xdr, len * sizeof(*p));
        if (unlikely(!p))