linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] qed: fix assignment of n_rq_elems to incorrect params field
@ 2020-07-27 14:17 Colin King
  2020-07-27 14:36 ` Alexander Lobakin
  2020-07-27 16:17 ` Jason Gunthorpe
  0 siblings, 2 replies; 5+ messages in thread
From: Colin King @ 2020-07-27 14:17 UTC (permalink / raw)
  To: Michal Kalderon, Ariel Elior, Doug Ledford, Jason Gunthorpe,
	Igor Russkikh, Alexander Lobakin, David S . Miller, linux-rdma
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Currently n_rq_elems is being assigned to params.elem_size instead of the
field params.num_elems.  Coverity is detecting this as a double assingment
to params.elem_size and reporting this as an usused value on the first
assignment.  Fix this.

Addresses-Coverity: ("Unused value")
Fixes: b6db3f71c976 ("qed: simplify chain allocation with init params struct")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/infiniband/hw/qedr/verbs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
index 5a80471577a6..4ce4e2eef6cc 100644
--- a/drivers/infiniband/hw/qedr/verbs.c
+++ b/drivers/infiniband/hw/qedr/verbs.c
@@ -1930,7 +1930,7 @@ qedr_roce_create_kernel_qp(struct qedr_dev *dev,
 	in_params->sq_pbl_ptr = qed_chain_get_pbl_phys(&qp->sq.pbl);
 
 	params.intended_use = QED_CHAIN_USE_TO_CONSUME_PRODUCE;
-	params.elem_size = n_rq_elems;
+	params.num_elems = n_rq_elems;
 	params.elem_size = QEDR_RQE_ELEMENT_SIZE;
 
 	rc = dev->ops->common->chain_alloc(dev->cdev, &qp->rq.pbl, &params);
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] qed: fix assignment of n_rq_elems to incorrect params field
  2020-07-27 14:17 [PATCH] qed: fix assignment of n_rq_elems to incorrect params field Colin King
@ 2020-07-27 14:36 ` Alexander Lobakin
  2020-07-27 14:39   ` Colin Ian King
  2020-07-27 16:17 ` Jason Gunthorpe
  1 sibling, 1 reply; 5+ messages in thread
From: Alexander Lobakin @ 2020-07-27 14:36 UTC (permalink / raw)
  To: Colin King
  Cc: Alexander Lobakin, Michal Kalderon, Ariel Elior, Doug Ledford,
	Jason Gunthorpe, Igor Russkikh, David S. Miller, linux-rdma,
	kernel-janitors, linux-kernel

Hi Colin,

From: Colin King <colin.king@canonical.com>
Date: Mon, 27 Jul 2020 15:17:12 +0100

> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently n_rq_elems is being assigned to params.elem_size instead of the
> field params.num_elems.  Coverity is detecting this as a double assingment
> to params.elem_size and reporting this as an usused value on the first
> assignment.  Fix this.
> 
> Addresses-Coverity: ("Unused value")
> Fixes: b6db3f71c976 ("qed: simplify chain allocation with init params struct")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/infiniband/hw/qedr/verbs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
> index 5a80471577a6..4ce4e2eef6cc 100644
> --- a/drivers/infiniband/hw/qedr/verbs.c
> +++ b/drivers/infiniband/hw/qedr/verbs.c
> @@ -1930,7 +1930,7 @@ qedr_roce_create_kernel_qp(struct qedr_dev *dev,
>  	in_params->sq_pbl_ptr = qed_chain_get_pbl_phys(&qp->sq.pbl);
>  
>  	params.intended_use = QED_CHAIN_USE_TO_CONSUME_PRODUCE;
> -	params.elem_size = n_rq_elems;
> +	params.num_elems = n_rq_elems;

Sorry for copy'n'paste braino. Thanks for catching.

>  	params.elem_size = QEDR_RQE_ELEMENT_SIZE;
>  
>  	rc = dev->ops->common->chain_alloc(dev->cdev, &qp->rq.pbl, &params);
> -- 
> 2.27.0

Acked-by: Alexander Lobakin <alobakin@marvell.com>

Al

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] qed: fix assignment of n_rq_elems to incorrect params field
  2020-07-27 14:36 ` Alexander Lobakin
@ 2020-07-27 14:39   ` Colin Ian King
  0 siblings, 0 replies; 5+ messages in thread
From: Colin Ian King @ 2020-07-27 14:39 UTC (permalink / raw)
  To: Alexander Lobakin
  Cc: Michal Kalderon, Ariel Elior, Doug Ledford, Jason Gunthorpe,
	Igor Russkikh, David S. Miller, linux-rdma, kernel-janitors,
	linux-kernel

On 27/07/2020 15:36, Alexander Lobakin wrote:
> Hi Colin,
> 
> From: Colin King <colin.king@canonical.com>
> Date: Mon, 27 Jul 2020 15:17:12 +0100
> 
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> Currently n_rq_elems is being assigned to params.elem_size instead of the
>> field params.num_elems.  Coverity is detecting this as a double assingment
>> to params.elem_size and reporting this as an usused value on the first
>> assignment.  Fix this.
>>
>> Addresses-Coverity: ("Unused value")
>> Fixes: b6db3f71c976 ("qed: simplify chain allocation with init params struct")
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>>  drivers/infiniband/hw/qedr/verbs.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
>> index 5a80471577a6..4ce4e2eef6cc 100644
>> --- a/drivers/infiniband/hw/qedr/verbs.c
>> +++ b/drivers/infiniband/hw/qedr/verbs.c
>> @@ -1930,7 +1930,7 @@ qedr_roce_create_kernel_qp(struct qedr_dev *dev,
>>  	in_params->sq_pbl_ptr = qed_chain_get_pbl_phys(&qp->sq.pbl);
>>  
>>  	params.intended_use = QED_CHAIN_USE_TO_CONSUME_PRODUCE;
>> -	params.elem_size = n_rq_elems;
>> +	params.num_elems = n_rq_elems;
> 
> Sorry for copy'n'paste braino. Thanks for catching.

Kudos goes to Coverity, it's good at finding these buglets. :-)

> 
>>  	params.elem_size = QEDR_RQE_ELEMENT_SIZE;
>>  
>>  	rc = dev->ops->common->chain_alloc(dev->cdev, &qp->rq.pbl, &params);
>> -- 
>> 2.27.0
> 
> Acked-by: Alexander Lobakin <alobakin@marvell.com>
> 
> Al
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] qed: fix assignment of n_rq_elems to incorrect params field
  2020-07-27 14:17 [PATCH] qed: fix assignment of n_rq_elems to incorrect params field Colin King
  2020-07-27 14:36 ` Alexander Lobakin
@ 2020-07-27 16:17 ` Jason Gunthorpe
  2020-07-27 19:46   ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Jason Gunthorpe @ 2020-07-27 16:17 UTC (permalink / raw)
  To: Colin King, David S . Miller
  Cc: Michal Kalderon, Ariel Elior, Doug Ledford, Igor Russkikh,
	Alexander Lobakin, linux-rdma, kernel-janitors, linux-kernel

On Mon, Jul 27, 2020 at 03:17:12PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently n_rq_elems is being assigned to params.elem_size instead of the
> field params.num_elems.  Coverity is detecting this as a double assingment
> to params.elem_size and reporting this as an usused value on the first
> assignment.  Fix this.
> 
> Addresses-Coverity: ("Unused value")
> Fixes: b6db3f71c976 ("qed: simplify chain allocation with init params struct")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/infiniband/hw/qedr/verbs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

DaveM will need to take this since the Fixed patch is in his tree,
thanks.

Jason

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] qed: fix assignment of n_rq_elems to incorrect params field
  2020-07-27 16:17 ` Jason Gunthorpe
@ 2020-07-27 19:46   ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2020-07-27 19:46 UTC (permalink / raw)
  To: jgg
  Cc: colin.king, mkalderon, aelior, dledford, irusskikh, alobakin,
	linux-rdma, kernel-janitors, linux-kernel

From: Jason Gunthorpe <jgg@nvidia.com>
Date: Mon, 27 Jul 2020 13:17:39 -0300

> On Mon, Jul 27, 2020 at 03:17:12PM +0100, Colin King wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>> 
>> Currently n_rq_elems is being assigned to params.elem_size instead of the
>> field params.num_elems.  Coverity is detecting this as a double assingment
>> to params.elem_size and reporting this as an usused value on the first
>> assignment.  Fix this.
>> 
>> Addresses-Coverity: ("Unused value")
>> Fixes: b6db3f71c976 ("qed: simplify chain allocation with init params struct")
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>>  drivers/infiniband/hw/qedr/verbs.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> DaveM will need to take this since the Fixed patch is in his tree,
> thanks.

Applied to net-next, thanks everyone.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-07-27 19:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-27 14:17 [PATCH] qed: fix assignment of n_rq_elems to incorrect params field Colin King
2020-07-27 14:36 ` Alexander Lobakin
2020-07-27 14:39   ` Colin Ian King
2020-07-27 16:17 ` Jason Gunthorpe
2020-07-27 19:46   ` David Miller

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).