Skip to content

Commit 2790143

Browse files
JiangJiasjonmason
authored andcommitted
NTB: ntb_tool: Add check for devm_kcalloc
As the devm_kcalloc may return NULL pointer, it should be better to add check for the return value, as same as the others. Fixes: 7f46c8b ("NTB: ntb_tool: Add full multi-port NTB API support") Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Reviewed-by: Serge Semin <fancer.lancer@gmail.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Jon Mason <jdmason@kudzu.us>
1 parent 8623ccb commit 2790143

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/ntb/test/ntb_tool.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,8 @@ static int tool_init_mws(struct tool_ctx *tc)
998998
tc->peers[pidx].outmws =
999999
devm_kcalloc(&tc->ntb->dev, tc->peers[pidx].outmw_cnt,
10001000
sizeof(*tc->peers[pidx].outmws), GFP_KERNEL);
1001+
if (tc->peers[pidx].outmws == NULL)
1002+
return -ENOMEM;
10011003

10021004
for (widx = 0; widx < tc->peers[pidx].outmw_cnt; widx++) {
10031005
tc->peers[pidx].outmws[widx].pidx = pidx;

0 commit comments

Comments
 (0)