Skip to content

Commit 509cc96

Browse files
committed
ocrdma: Fix uninit_use issues
Fix the following issues: Error: UNINIT (CWE-457): [#def138] [important] providers/ocrdma/ocrdma_main.c:118:2: var_decl: Declaring variable "resp" without initializer. providers/ocrdma/ocrdma_main.c:132:2: uninit_use: Using uninitialized value "resp.dev_id". Error: UNINIT (CWE-457): [#def140] [important] providers/ocrdma/ocrdma_verbs.c:359:2: var_decl: Declaring variable "resp" without initializer. providers/ocrdma/ocrdma_verbs.c:373:2: uninit_use: Using uninitialized value "resp.rq_dbid". Error: UNINIT (CWE-457): [#def141] [important] providers/ocrdma/ocrdma_verbs.c:469:2: var_decl: Declaring variable "resp" without initializer. providers/ocrdma/ocrdma_verbs.c:504:2: uninit_use: Using uninitialized value "resp.qp_id". Fixes: ede3115 ("Added libocrdma files") Signed-off-by: Kamal Heib <[email protected]>
1 parent b85b2e7 commit 509cc96

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

providers/ocrdma/ocrdma_main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static struct verbs_context *ocrdma_alloc_context(struct ibv_device *ibdev,
115115
{
116116
struct ocrdma_devctx *ctx;
117117
struct uocrdma_get_context cmd;
118-
struct uocrdma_get_context_resp resp;
118+
struct uocrdma_get_context_resp resp = {};
119119

120120
ctx = verbs_init_and_alloc_context(ibdev, cmd_fd, ctx, ibv_ctx,
121121
RDMA_DRIVER_OCRDMA);

providers/ocrdma/ocrdma_verbs.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ struct ibv_srq *ocrdma_create_srq(struct ibv_pd *pd,
356356
int status = 0;
357357
struct ocrdma_srq *srq;
358358
struct uocrdma_create_srq cmd;
359-
struct uocrdma_create_srq_resp resp;
359+
struct uocrdma_create_srq_resp resp = {};
360360
void *map_addr;
361361

362362
srq = calloc(1, sizeof *srq);
@@ -466,7 +466,7 @@ struct ibv_qp *ocrdma_create_qp(struct ibv_pd *pd,
466466
{
467467
int status = 0;
468468
struct uocrdma_create_qp cmd;
469-
struct uocrdma_create_qp_resp resp;
469+
struct uocrdma_create_qp_resp resp = {};
470470
struct ocrdma_qp *qp;
471471
void *map_addr;
472472
#ifdef DPP_CQ_SUPPORT

0 commit comments

Comments
 (0)