Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1cf76c4e authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Chanwoo Choi
Browse files

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
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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;