提交 7dde60c0 编写于 作者: C Colin Ian King 提交者: Greg Kroah-Hartman

slimbus: avoid null pointer dereference on msg

The pointer msg is checked to see if it is null at the start of
the function and jumps to the error exit label reterr that then
dereferences msg when it prints a dev_err error message. Avoid
this potential null pointer dereference by only printing the
error message if msg is not null.

Detected by CoverityScan, CID#1463141 ("Dereference after null check")
Signed-off-by: NColin Ian King <colin.king@canonical.com>
Signed-off-by: NSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 0edff03d
...@@ -170,6 +170,7 @@ static int slim_val_inf_sanity(struct slim_controller *ctrl, ...@@ -170,6 +170,7 @@ static int slim_val_inf_sanity(struct slim_controller *ctrl,
break; break;
} }
reterr: reterr:
if (msg)
dev_err(ctrl->dev, "Sanity check failed:msg:offset:0x%x, mc:%d\n", dev_err(ctrl->dev, "Sanity check failed:msg:offset:0x%x, mc:%d\n",
msg->start_offset, mc); msg->start_offset, mc);
return -EINVAL; return -EINVAL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册