Skip to content

Commit

Permalink
xprtrdma: fix incorrect header size calculations
Browse files Browse the repository at this point in the history
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: 302d3de ("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>
  • Loading branch information
Colin Ian King authored and Anna Schumaker committed Jul 15, 2020
1 parent 913fadc commit 9122884
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/sunrpc/xprtrdma/rpc_rdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static unsigned int rpcrdma_max_call_header_size(unsigned int maxsegs)
size = RPCRDMA_HDRLEN_MIN;

/* Maximum Read list size */
size = maxsegs * rpcrdma_readchunk_maxsz * sizeof(__be32);
size += maxsegs * rpcrdma_readchunk_maxsz * sizeof(__be32);

/* Minimal Read chunk size */
size += sizeof(__be32); /* segment count */
Expand All @@ -94,7 +94,7 @@ static unsigned int rpcrdma_max_reply_header_size(unsigned int maxsegs)
size = RPCRDMA_HDRLEN_MIN;

/* Maximum Write list size */
size = sizeof(__be32); /* segment count */
size += sizeof(__be32); /* segment count */
size += maxsegs * rpcrdma_segment_maxsz * sizeof(__be32);
size += sizeof(__be32); /* list discriminator */

Expand Down

0 comments on commit 9122884

Please sign in to comment.