Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Christophe JAILLET and committed by
Chanwoo Choi
1cf76c4e 5c27036d

+2
+2
drivers/extcon/extcon-usbc-cros-ec.c
··· 68 68 int ret; 69 69 70 70 msg = kzalloc(sizeof(*msg) + max(outsize, insize), GFP_KERNEL); 71 + if (!msg) 72 + return -ENOMEM; 71 73 72 74 msg->version = version; 73 75 msg->command = command;