[v2,iproute2-next,2/6] rdma: initialize the rd struct

Message ID 0ba0136867d1d296e4d1855cac322fdd88025ce3.1520020530.git.swise@opengridcomputing.com
State Changes Requested
Delegated to: David Ahern
Headers show
Series
  • cm_id, cq, mr, and pd resource tracking
Related show

Commit Message

Steve Wise Feb. 27, 2018, 4:07 p.m.
Initialize the rd struct so port_idx is 0 unless set otherwise.
Otherwise, strict_port queries end up passing an uninitialized PORT
nlattr.

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
---
 rdma/rdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Leon Romanovsky March 13, 2018, 6:11 p.m. | #1
On Tue, Feb 27, 2018 at 08:07:00AM -0800, Steve Wise wrote:
> Initialize the rd struct so port_idx is 0 unless set otherwise.
> Otherwise, strict_port queries end up passing an uninitialized PORT
> nlattr.
>
> Signed-off-by: Steve Wise <swise@opengridcomputing.com>
> ---
>  rdma/rdma.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

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

Patch

diff --git a/rdma/rdma.c b/rdma/rdma.c
index 19608f4..c652550 100644
--- a/rdma/rdma.c
+++ b/rdma/rdma.c
@@ -93,7 +93,7 @@  int main(int argc, char **argv)
 	bool show_details = false;
 	bool json_output = false;
 	char *filename;
-	struct rd rd;
+	struct rd rd = {};
 	int opt;
 	int err;