Revert "SUNRPC: clean up integer overflow check"
authorAnna Schumaker <Anna.Schumaker@Netapp.com>
Fri, 15 Sep 2023 19:46:08 +0000 (15:46 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Fri, 15 Sep 2023 19:50:24 +0000 (15:50 -0400)
This reverts commit e87cf8a28e7592bd19064e8181324ae26bc02932.

This commit was added to silence a tautological comparison warning, but
removing the 'len' value check before calling xdr_inline_decode() is
really not what we want.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
include/linux/sunrpc/xdr.h

index 5b4fb3c791bc267042a9af1b7384e606ae0b043f..896a6d2a9cf008364f1e979af1ccb88c96e65ce4 100644 (file)
@@ -779,7 +779,9 @@ xdr_stream_decode_uint32_array(struct xdr_stream *xdr,
 
        if (unlikely(xdr_stream_decode_u32(xdr, &len) < 0))
                return -EBADMSG;
-       p = xdr_inline_decode(xdr, size_mul(len, sizeof(*p)));
+       if (len > SIZE_MAX / sizeof(*p))
+               return -EBADMSG;
+       p = xdr_inline_decode(xdr, len * sizeof(*p));
        if (unlikely(!p))
                return -EBADMSG;
        if (array == NULL)