* [PATCH] xprtrdma: fix incorrect header size calcations
@ 2020-07-15 16:26 Colin King
2020-07-15 16:31 ` Colin Ian King
0 siblings, 1 reply; 4+ messages in thread
From: Colin King @ 2020-07-15 16:26 UTC (permalink / raw)
To: Trond Myklebust, Anna Schumaker, J . Bruce Fields, Chuck Lever,
David S . Miller, Jakub Kicinski, linux-nfs, netdev
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
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>
---
net/sunrpc/xprtrdma/rpc_rdma.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c
index 935bbef2f7be..453bacc99907 100644
--- a/net/sunrpc/xprtrdma/rpc_rdma.c
+++ b/net/sunrpc/xprtrdma/rpc_rdma.c
@@ -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 */
@@ -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 */
--
2.27.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] xprtrdma: fix incorrect header size calcations
2020-07-15 16:26 [PATCH] xprtrdma: fix incorrect header size calcations Colin King
@ 2020-07-15 16:31 ` Colin Ian King
2020-07-15 16:39 ` Chuck Lever
2020-07-15 16:40 ` Anna Schumaker
0 siblings, 2 replies; 4+ messages in thread
From: Colin Ian King @ 2020-07-15 16:31 UTC (permalink / raw)
To: Trond Myklebust, Anna Schumaker, J . Bruce Fields, Chuck Lever,
David S . Miller, Jakub Kicinski, linux-nfs, netdev
Cc: kernel-janitors, linux-kernel
Bah, $SUBJECT typo "calcations" -> "calculations". can that be fixed up
when it's applied, or shall I send a V2?
On 15/07/2020 17:26, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> 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>
> ---
> net/sunrpc/xprtrdma/rpc_rdma.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c
> index 935bbef2f7be..453bacc99907 100644
> --- a/net/sunrpc/xprtrdma/rpc_rdma.c
> +++ b/net/sunrpc/xprtrdma/rpc_rdma.c
> @@ -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 */
> @@ -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 */
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xprtrdma: fix incorrect header size calcations
2020-07-15 16:31 ` Colin Ian King
@ 2020-07-15 16:39 ` Chuck Lever
2020-07-15 16:40 ` Anna Schumaker
1 sibling, 0 replies; 4+ messages in thread
From: Chuck Lever @ 2020-07-15 16:39 UTC (permalink / raw)
To: Colin Ian King
Cc: Trond Myklebust, Anna Schumaker, Bruce Fields, David S . Miller,
Jakub Kicinski, Linux NFS Mailing List, netdev, kernel-janitors,
linux-kernel
> On Jul 15, 2020, at 12:31 PM, Colin Ian King <colin.king@canonical.com> wrote:
>
> Bah, $SUBJECT typo "calcations" -> "calculations". can that be fixed up
> when it's applied, or shall I send a V2?
Anna's preference.
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
> On 15/07/2020 17:26, Colin King wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> 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>
>> ---
>> net/sunrpc/xprtrdma/rpc_rdma.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c
>> index 935bbef2f7be..453bacc99907 100644
>> --- a/net/sunrpc/xprtrdma/rpc_rdma.c
>> +++ b/net/sunrpc/xprtrdma/rpc_rdma.c
>> @@ -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 */
>> @@ -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 */
>>
>>
>
--
Chuck Lever
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xprtrdma: fix incorrect header size calcations
2020-07-15 16:31 ` Colin Ian King
2020-07-15 16:39 ` Chuck Lever
@ 2020-07-15 16:40 ` Anna Schumaker
1 sibling, 0 replies; 4+ messages in thread
From: Anna Schumaker @ 2020-07-15 16:40 UTC (permalink / raw)
To: Colin Ian King
Cc: Trond Myklebust, J . Bruce Fields, Chuck Lever, David S . Miller,
Jakub Kicinski, Linux NFS Mailing List, netdev, kernel-janitors,
Linux Kernel Mailing List
No need for a v2, I can fix it up!
On Wed, Jul 15, 2020 at 12:32 PM Colin Ian King
<colin.king@canonical.com> wrote:
>
> Bah, $SUBJECT typo "calcations" -> "calculations". can that be fixed up
> when it's applied, or shall I send a V2?
>
> On 15/07/2020 17:26, Colin King wrote:
> > From: Colin Ian King <colin.king@canonical.com>
> >
> > 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>
> > ---
> > net/sunrpc/xprtrdma/rpc_rdma.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c
> > index 935bbef2f7be..453bacc99907 100644
> > --- a/net/sunrpc/xprtrdma/rpc_rdma.c
> > +++ b/net/sunrpc/xprtrdma/rpc_rdma.c
> > @@ -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 */
> > @@ -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 */
> >
> >
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-07-15 16:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-15 16:26 [PATCH] xprtrdma: fix incorrect header size calcations Colin King
2020-07-15 16:31 ` Colin Ian King
2020-07-15 16:39 ` Chuck Lever
2020-07-15 16:40 ` Anna Schumaker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).