linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] RDMA/hns: Uninitialized variable in modify_qp_init_to_rtr()
@ 2020-05-29  8:39 Dan Carpenter
  2020-06-01  4:25 ` Leon Romanovsky
  2020-06-01 17:27 ` Jason Gunthorpe
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2020-05-29  8:39 UTC (permalink / raw)
  To: Lijun Ou, Xi Wang
  Cc: Wei Hu(Xavier),
	Weihang Li, Doug Ledford, Jason Gunthorpe, linux-rdma,
	linux-kernel, kernel-janitors

The "dmac" variable is used before it is initialized.

Fixes: 494c3b312255 ("RDMA/hns: Refactor the QP context filling process related to WQE buffer configure")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index 6454ac4ad06f0..c597d7281629b 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -4030,6 +4030,7 @@ static int modify_qp_init_to_rtr(struct ib_qp *ibqp,
 	port = (attr_mask & IB_QP_PORT) ? (attr->port_num - 1) : hr_qp->port;
 
 	smac = (u8 *)hr_dev->dev_addr[port];
+	dmac = (u8 *)attr->ah_attr.roce.dmac;
 	/* when dmac equals smac or loop_idc is 1, it should loopback */
 	if (ether_addr_equal_unaligned(dmac, smac) ||
 	    hr_dev->loop_idc == 0x1) {
@@ -4053,7 +4054,6 @@ static int modify_qp_init_to_rtr(struct ib_qp *ibqp,
 	roce_set_field(qpc_mask->byte_20_smac_sgid_idx,
 		       V2_QPC_BYTE_20_SGID_IDX_M, V2_QPC_BYTE_20_SGID_IDX_S, 0);
 
-	dmac = (u8 *)attr->ah_attr.roce.dmac;
 	memcpy(&(context->dmac), dmac, sizeof(u32));
 	roce_set_field(context->byte_52_udpspn_dmac, V2_QPC_BYTE_52_DMAC_M,
 		       V2_QPC_BYTE_52_DMAC_S, *((u16 *)(&dmac[4])));
-- 
2.26.2


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

* Re: [PATCH] RDMA/hns: Uninitialized variable in modify_qp_init_to_rtr()
  2020-05-29  8:39 [PATCH] RDMA/hns: Uninitialized variable in modify_qp_init_to_rtr() Dan Carpenter
@ 2020-06-01  4:25 ` Leon Romanovsky
  2020-06-01 17:27 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2020-06-01  4:25 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Lijun Ou, Xi Wang, Wei Hu(Xavier),
	Weihang Li, Doug Ledford, Jason Gunthorpe, linux-rdma,
	linux-kernel, kernel-janitors

On Fri, May 29, 2020 at 11:39:18AM +0300, Dan Carpenter wrote:
> The "dmac" variable is used before it is initialized.
>
> Fixes: 494c3b312255 ("RDMA/hns: Refactor the QP context filling process related to WQE buffer configure")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Thanks,
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>

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

* Re: [PATCH] RDMA/hns: Uninitialized variable in modify_qp_init_to_rtr()
  2020-05-29  8:39 [PATCH] RDMA/hns: Uninitialized variable in modify_qp_init_to_rtr() Dan Carpenter
  2020-06-01  4:25 ` Leon Romanovsky
@ 2020-06-01 17:27 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2020-06-01 17:27 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Lijun Ou, Xi Wang, Wei Hu(Xavier),
	Weihang Li, Doug Ledford, linux-rdma, linux-kernel,
	kernel-janitors

On Fri, May 29, 2020 at 11:39:18AM +0300, Dan Carpenter wrote:
> The "dmac" variable is used before it is initialized.
> 
> Fixes: 494c3b312255 ("RDMA/hns: Refactor the QP context filling process related to WQE buffer configure")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
> ---
>  drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-next, thanks

Jason

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

end of thread, other threads:[~2020-06-01 17:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-29  8:39 [PATCH] RDMA/hns: Uninitialized variable in modify_qp_init_to_rtr() Dan Carpenter
2020-06-01  4:25 ` Leon Romanovsky
2020-06-01 17:27 ` Jason Gunthorpe

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