diff mbox series

[4/4] hw/pvrdma: Fix zero-initialization of resp in {query/modify}_qp

Message ID 20190313084648.9513-5-kamalheib1@gmail.com (mailing list archive)
State New, archived
Headers show
Series pvrdma: misc fixes | expand

Commit Message

Kamal Heib March 13, 2019, 8:46 a.m. UTC
Make sure to zero-initialize only the pvrdma_cmd_query_qp_resp and not
the whole pvrdma_cmd_resp for query_qp, in modify_qp the resp isn't used
so remove it.

Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
 hw/rdma/vmw/pvrdma_cmd.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Yuval Shaia March 13, 2019, 9:35 a.m. UTC | #1
On Wed, Mar 13, 2019 at 10:46:48AM +0200, Kamal Heib wrote:
> Make sure to zero-initialize only the pvrdma_cmd_query_qp_resp and not
> the whole pvrdma_cmd_resp for query_qp, in modify_qp the resp isn't used
> so remove it.
> 
> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> ---
>  hw/rdma/vmw/pvrdma_cmd.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/hw/rdma/vmw/pvrdma_cmd.c b/hw/rdma/vmw/pvrdma_cmd.c
> index a0f2b13a2438..d1ca20a3f90d 100644
> --- a/hw/rdma/vmw/pvrdma_cmd.c
> +++ b/hw/rdma/vmw/pvrdma_cmd.c
> @@ -488,8 +488,6 @@ static int modify_qp(PVRDMADev *dev, union pvrdma_cmd_req *req,
>      struct pvrdma_cmd_modify_qp *cmd = &req->modify_qp;
>      int rc;
>  
> -    memset(rsp, 0, sizeof(*rsp));
> -
>      /* No need to verify sgid_index since it is u8 */
>  
>      rc = rdma_rm_modify_qp(&dev->rdma_dev_res, &dev->backend_dev,
> @@ -512,7 +510,7 @@ static int query_qp(PVRDMADev *dev, union pvrdma_cmd_req *req,
>      struct ibv_qp_init_attr init_attr;
>      int rc;
>  
> -    memset(rsp, 0, sizeof(*rsp));
> +    memset(resp, 0, sizeof(*resp));
>  
>      rc = rdma_rm_query_qp(&dev->rdma_dev_res, &dev->backend_dev, cmd->qp_handle,
>                            (struct ibv_qp_attr *)&resp->attrs, cmd->attr_mask,

Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>

> -- 
> 2.20.1
> 
>
Yuval Shaia March 13, 2019, 11:52 a.m. UTC | #2
On Wed, Mar 13, 2019 at 10:46:48AM +0200, Kamal Heib wrote:
> Make sure to zero-initialize only the pvrdma_cmd_query_qp_resp and not
> the whole pvrdma_cmd_resp for query_qp, in modify_qp the resp isn't used
> so remove it.
> 
> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> ---
>  hw/rdma/vmw/pvrdma_cmd.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/hw/rdma/vmw/pvrdma_cmd.c b/hw/rdma/vmw/pvrdma_cmd.c
> index a0f2b13a2438..d1ca20a3f90d 100644
> --- a/hw/rdma/vmw/pvrdma_cmd.c
> +++ b/hw/rdma/vmw/pvrdma_cmd.c
> @@ -488,8 +488,6 @@ static int modify_qp(PVRDMADev *dev, union pvrdma_cmd_req *req,
>      struct pvrdma_cmd_modify_qp *cmd = &req->modify_qp;
>      int rc;
>  
> -    memset(rsp, 0, sizeof(*rsp));
> -
>      /* No need to verify sgid_index since it is u8 */
>  
>      rc = rdma_rm_modify_qp(&dev->rdma_dev_res, &dev->backend_dev,
> @@ -512,7 +510,7 @@ static int query_qp(PVRDMADev *dev, union pvrdma_cmd_req *req,
>      struct ibv_qp_init_attr init_attr;
>      int rc;
>  
> -    memset(rsp, 0, sizeof(*rsp));
> +    memset(resp, 0, sizeof(*resp));
>  
>      rc = rdma_rm_query_qp(&dev->rdma_dev_res, &dev->backend_dev, cmd->qp_handle,
>                            (struct ibv_qp_attr *)&resp->attrs, cmd->attr_mask,
> -- 

Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>

> 2.20.1
> 
>
diff mbox series

Patch

diff --git a/hw/rdma/vmw/pvrdma_cmd.c b/hw/rdma/vmw/pvrdma_cmd.c
index a0f2b13a2438..d1ca20a3f90d 100644
--- a/hw/rdma/vmw/pvrdma_cmd.c
+++ b/hw/rdma/vmw/pvrdma_cmd.c
@@ -488,8 +488,6 @@  static int modify_qp(PVRDMADev *dev, union pvrdma_cmd_req *req,
     struct pvrdma_cmd_modify_qp *cmd = &req->modify_qp;
     int rc;
 
-    memset(rsp, 0, sizeof(*rsp));
-
     /* No need to verify sgid_index since it is u8 */
 
     rc = rdma_rm_modify_qp(&dev->rdma_dev_res, &dev->backend_dev,
@@ -512,7 +510,7 @@  static int query_qp(PVRDMADev *dev, union pvrdma_cmd_req *req,
     struct ibv_qp_init_attr init_attr;
     int rc;
 
-    memset(rsp, 0, sizeof(*rsp));
+    memset(resp, 0, sizeof(*resp));
 
     rc = rdma_rm_query_qp(&dev->rdma_dev_res, &dev->backend_dev, cmd->qp_handle,
                           (struct ibv_qp_attr *)&resp->attrs, cmd->attr_mask,