]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
xprtrdma: fix incorrect header size calculations
authorColin Ian King <colin.king@canonical.com>
Wed, 15 Jul 2020 16:26:04 +0000 (17:26 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 Jun 2022 09:49:18 +0000 (11:49 +0200)
commit 912288442cb2f431bf3c8cb097a5de83bc6dbac1 upstream.

Currently the header size calculations are using an assignment
operator instead of a += operator when accumulating the header
size leading to incorrect sizes.  Fix this by using the correct
operator.

Addresses-Coverity: ("Unused value")
Fixes: 302d3deb2068 ("xprtrdma: Prevent inline overflow")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
[bwh: Backported to 4.19: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/sunrpc/xprtrdma/rpc_rdma.c

index 3d65a2bccfc7bb5af811168cdfa0753302d8dd9d..7f9d8365c932011bca5b80e64999f3c14df1ec83 100644 (file)
@@ -72,7 +72,7 @@ static unsigned int rpcrdma_max_call_header_size(unsigned int maxsegs)
 
        /* Maximum Read list size */
        maxsegs += 2;   /* segment for head and tail buffers */
-       size = maxsegs * rpcrdma_readchunk_maxsz * sizeof(__be32);
+       size += maxsegs * rpcrdma_readchunk_maxsz * sizeof(__be32);
 
        /* Minimal Read chunk size */
        size += sizeof(__be32); /* segment count */
@@ -98,7 +98,7 @@ static unsigned int rpcrdma_max_reply_header_size(unsigned int maxsegs)
 
        /* Maximum Write list size */
        maxsegs += 2;   /* segment for head and tail buffers */
-       size = sizeof(__be32);          /* segment count */
+       size += sizeof(__be32);         /* segment count */
        size += maxsegs * rpcrdma_segment_maxsz * sizeof(__be32);
        size += sizeof(__be32); /* list discriminator */