Commit 1cf76c4e authored by Christophe JAILLET's avatar Christophe JAILLET Committed by 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: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
parent 5c27036d
...@@ -68,6 +68,8 @@ static int cros_ec_pd_command(struct cros_ec_extcon_info *info, ...@@ -68,6 +68,8 @@ static int cros_ec_pd_command(struct cros_ec_extcon_info *info,
int ret; int ret;
msg = kzalloc(sizeof(*msg) + max(outsize, insize), GFP_KERNEL); msg = kzalloc(sizeof(*msg) + max(outsize, insize), GFP_KERNEL);
if (!msg)
return -ENOMEM;
msg->version = version; msg->version = version;
msg->command = command; msg->command = command;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment