Skip to content

Commit

Permalink
srp_daemon: check return value of function 'umad_init'
Browse files Browse the repository at this point in the history
Error: CHECKED_RETURN (CWE-252):
rdma-core-28.0/srp_daemon/srp_daemon.c:2164: check_return: Calling "umad_init" without checking return value (as is done elsewhere 8 out of 10 times).
rdma-core-28.0/ibacm/src/acm.c:3331: example_checked: Example 1: "umad_init()" has its value checked in "umad_init() != 0".
rdma-core-28.0/infiniband-diags/ibstat.c:305: example_checked: Example 2: "umad_init()" has its value checked in "umad_init() < 0".
rdma-core-28.0/infiniband-diags/saquery.c:1855: example_checked: Example 3: "umad_init()" has its value checked in "umad_init()".
rdma-core-28.0/infiniband-diags/smpdump.c:217: example_checked: Example 4: "umad_init()" has its value checked in "umad_init() < 0".
rdma-core-28.0/libibmad/rpc.c:385: example_checked: Example 5: "umad_init()" has its value checked in "umad_init() < 0".
|# 2162|     }
|# 2163|
|# 2164|->   umad_init();
|# 2165|     res = alloc_res();
|# 2166|     if (!res) {

Signed-off-by: Honggang Li <honli@redhat.com>
  • Loading branch information
Honggang-LI committed Feb 20, 2020
1 parent 4a0245e commit 00dba86
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion srp_daemon/srp_daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -2161,7 +2161,10 @@ static int ibsrpdm(int argc, char *argv[])
goto out;
}

umad_init();
ret = umad_init();
if (ret != 0)
goto out;

res = alloc_res();
if (!res) {
ret = 1;
Expand Down

0 comments on commit 00dba86

Please sign in to comment.