提交 1cf76c4e 编写于 作者: C Christophe JAILLET 提交者: Chanwoo Choi

extcon: cros-ec: Fix a potential NULL pointer dereference

Return -ENOMEM in case of memory allocation failure. This avoids a NULL
pointer dereference.

Fixes: c6983166 ("extcon: cros-ec: Add extcon-cros-ec driver to support display out")
Signed-off-by: NChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: NChanwoo Choi <cw00.choi@samsung.com>
上级 5c27036d
......@@ -68,6 +68,8 @@ static int cros_ec_pd_command(struct cros_ec_extcon_info *info,
int ret;
msg = kzalloc(sizeof(*msg) + max(outsize, insize), GFP_KERNEL);
if (!msg)
return -ENOMEM;
msg->version = version;
msg->command = command;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册