diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2017-08-07 02:30:33 -0400 |
---|---|---|
committer | Chanwoo Choi <cw00.choi@samsung.com> | 2017-08-07 02:34:20 -0400 |
commit | 1cf76c4eeb07ba31a03066c6540d96fd64d7a34f (patch) | |
tree | 4ac92b7a94731c59b9c4e664474d1d939b4fd1a6 | |
parent | 5c27036d2b05d6bc763809871b58a48e9fa554fa (diff) |
extcon: cros-ec: Fix a potential NULL pointer dereference
Return -ENOMEM in case of memory allocation failure. This avoids a NULL
pointer dereference.
Fixes: c69831666109 ("extcon: cros-ec: Add extcon-cros-ec driver to support display out")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
-rw-r--r-- | drivers/extcon/extcon-usbc-cros-ec.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/extcon/extcon-usbc-cros-ec.c b/drivers/extcon/extcon-usbc-cros-ec.c index e759ed477735..598956f1dcae 100644 --- a/drivers/extcon/extcon-usbc-cros-ec.c +++ b/drivers/extcon/extcon-usbc-cros-ec.c | |||
@@ -68,6 +68,8 @@ static int cros_ec_pd_command(struct cros_ec_extcon_info *info, | |||
68 | int ret; | 68 | int ret; |
69 | 69 | ||
70 | msg = kzalloc(sizeof(*msg) + max(outsize, insize), GFP_KERNEL); | 70 | msg = kzalloc(sizeof(*msg) + max(outsize, insize), GFP_KERNEL); |
71 | if (!msg) | ||
72 | return -ENOMEM; | ||
71 | 73 | ||
72 | msg->version = version; | 74 | msg->version = version; |
73 | msg->command = command; | 75 | msg->command = command; |