Return-Path: Received: from mail-by2nam01on0115.outbound.protection.outlook.com ([104.47.34.115]:14144 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932795AbeCCWap (ORCPT ); Sat, 3 Mar 2018 17:30:45 -0500 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: "Gustavo A. R. Silva" , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 64/84] media: davinci: vpif_capture: add NULL check on devm_kzalloc return value Date: Sat, 3 Mar 2018 22:26:37 +0000 Message-ID: <20180303222518.26271-64-alexander.levin@microsoft.com> References: <20180303222518.26271-1-alexander.levin@microsoft.com> In-Reply-To: <20180303222518.26271-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: "Gustavo A. R. Silva" [ Upstream commit 5a18c2434f8bfc8bc2fb0f8af3e44f7408d63e4f ] Check return value from call to devm_kzalloc() in order to prevent a NULL pointer dereference. This issue was detected with the help of Coccinelle. Fixes: 4a5f8ae50b66 ("[media] davinci: vpif_capture: get subdevs from DT wh= en available") Signed-off-by: Gustavo A. R. Silva Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/davinci/vpif_capture.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/= platform/davinci/vpif_capture.c index 0ef36cec21d1..233622bef4a5 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -1545,6 +1545,8 @@ vpif_capture_get_pdata(struct platform_device *pdev) sizeof(*chan->inputs) * VPIF_CAPTURE_NUM_CHANNELS, GFP_KERNEL); + if (!chan->inputs) + return NULL; =20 chan->input_count++; chan->inputs[i].input.type =3D V4L2_INPUT_TYPE_CAMERA; --=20 2.14.1