Received: by 10.213.65.68 with SMTP id h4csp1272428imn; Sun, 18 Mar 2018 22:34:28 -0700 (PDT) X-Google-Smtp-Source: AG47ELsLTutDCe536Qt3HN/4WyBP/2XNBcFQehFFiL2hkBXmPMw0a7uIDFIkFiNTxWjS9gqF8aWn X-Received: by 2002:a17:902:4d45:: with SMTP id o5-v6mr2623814plh.84.1521437668030; Sun, 18 Mar 2018 22:34:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521437668; cv=none; d=google.com; s=arc-20160816; b=r+Zs1TdUfEyJkifaO9xPvCq//2unJfAOpMrYcmFstchFKE/kGpMH24Fn245KnXx7sf YZGAJKDpYp+ccmmp9XY0awtRQrm46FTzytLUGlWdVn/z9XQEXqmge/zUYxhL75/iQ0Jb DIIJeVQpitayR/jQGezZt3Ren6aOuEn+03lHpXIEfcCxPBpLNSGT7yHvIZTdcsb+vC6N oSltq5EXjghe8NrEo0t2wQBC5dn2580sON42yZPFDQFBNvSBR2mhhxbwDd84iKPdz7Z9 hSMs7lj1rLzyal4ruNf1RDsvbFKIRuYPA56Eb0AcdqI0b0Fwecly4+EfpmJJAVJtK/KK 27Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:dlp-filter:cms-type:message-id :date:subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=rf69jUDJ/xP9mjsFfqYX8+R9Q8ZbXcXpuPtNNlJR4Xw=; b=CSOjcFaEPGdJQYKUx2BSckZnZb5hmEaU9/U58ySwb9TPkKye/PmHW6VjrMsRWd/BPC 0sR5RxRxq1DrZzvA0XUcCei08pQoBYBX+X6PuVigSKwp/75wGRC6nkwNDBclSbaO07bc CfpCjT8uUexWE0qi0u+2oVCqygicF/qOoqpRm7Al0gwvXLvz7sehyWJwsoVGQIhq/tup AX5alnivQ9F4IAnlf5j1lIh+siT7s6LK4uaUmDY19BgSZXmJxBt+DPfcP7lZvpRpHrF9 wpE+aMTD/vE9aROtPgwVRmW7m6bn1fniNOZ6IKYLbSk5P9RRtTDw04kkvg6IyuNimT4E L8oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Q16TgOaQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k20-v6si10907560pls.294.2018.03.18.22.34.13; Sun, 18 Mar 2018 22:34:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Q16TgOaQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755158AbeCSFdV (ORCPT + 99 others); Mon, 19 Mar 2018 01:33:21 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:12510 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752273AbeCSFdS (ORCPT ); Mon, 19 Mar 2018 01:33:18 -0400 Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20180319053316epoutp03960b83dba2d41b9f7b6094b072196c14~dO27CxJqA1719117191epoutp03Y; Mon, 19 Mar 2018 05:33:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20180319053316epoutp03960b83dba2d41b9f7b6094b072196c14~dO27CxJqA1719117191epoutp03Y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1521437596; bh=rf69jUDJ/xP9mjsFfqYX8+R9Q8ZbXcXpuPtNNlJR4Xw=; h=From:To:Cc:Subject:Date:References:From; b=Q16TgOaQNoEs27adt4SvgSgwEDPczNcyHoBXrg0PKdgvtQ6Rg0JAlsbsIkvBcFotj Ozb2tmBjPKB6Zd+mlKc7QtW1AJWCXu3oJzGC8uSpT/bccfUdzNiGzBjRehbum0na3O Z7DPul+wfNZyKDVaRug4eLPjDoH7+v4VGDswcywE= Received: from epsmges2p1.samsung.com (unknown [182.195.40.94]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20180319053315epcas1p1b232c5edb5646b24ca8927b9fab871cd~dO26xVaGv1846318463epcas1p1Q; Mon, 19 Mar 2018 05:33:15 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 4E.18.04131.B9B4FAA5; Mon, 19 Mar 2018 14:33:15 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20180319053315epcas2p3c61bd9a1bec8d67cde77765842a3205c~dO26cqW_b0183801838epcas2p3j; Mon, 19 Mar 2018 05:33:15 +0000 (GMT) X-AuditID: b6c32a45-403ff70000001023-1b-5aaf4b9bfebe Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 11.31.03890.B9B4FAA5; Mon, 19 Mar 2018 14:33:15 +0900 (KST) Received: from localhost.localdomain ([10.253.107.61]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P5T00MIGOR86L80@mmp1.samsung.com>; Mon, 19 Mar 2018 14:33:15 +0900 (KST) From: Ji-Hun Kim To: mchehab@kernel.org, dan.carpenter@oracle.com Cc: gregkh@linuxfoundation.org, arvind.yadav.cs@gmail.com, ji_hun.kim@samsung.com, linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH v2] staging: media: davinci_vpfe: add error handling on kmalloc failure Date: Mon, 19 Mar 2018 14:32:57 +0900 Message-id: <1521437577-8168-1-git-send-email-ji_hun.kim@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrLKsWRmVeSWpSXmKPExsWy7bCmhe5s7/VRBtfmaVlc613IbPH633QW iz1nfrFbNC9ez2bRf3o7o8XWW9IWl3fNYbPo2bCV1WLZpj9MDpwe9/YdZvHYOesuu8emVZ1s HvvnrmH3+Pj0FotH35ZVjB6fN8kFsEel2mSkJqakFimk5iXnp2TmpdsqeQfHO8ebmhkY6hpa WpgrKeQl5qbaKrn4BOi6ZeYAXaakUJaYUwoUCkgsLlbSt7Mpyi8tSVXIyC8usVWKNjQ00jM0 MNczMjLSMzGPtTIyBSpJSM34dOAIS8FVrooz/+cyNTDe5+hi5OSQEDCRWLJ8MjuILSSwg1Hi VLNUFyMXkP2dUeLlnHPMMEW/7/1jhkjsZpRYN+sxE4Tzg1Hi4eIDbCBVbAKaEhu7rzF2MXJw iAgYSPTOjQapYRY4zyjRc+wRM0hcWCBSYutNN5ByFgFViYnv+8AW8Aq4SuxrfswKsUxO4uSx yawgvRICU9gkru+cxQiRcJE4NWEjO4QtLPHq+BYoW1ri2aqNUDXVEguu7GCBsGskbv5fygRh G0v09lwAW8YswCfRcfgvO8g9EgK8Eh1tQhAlHhJX1x+GanWUmLN4HRskVGIlNjy5zzSBUXIB I8MqRrHUguLc9NRiowJDveLE3OLSvHS95PzcTYzgpKLluoNxxjmfQ4wCHIxKPLwOR9dFCbEm lhVX5h5ilOBgVhLhfXoFKMSbklhZlVqUH19UmpNafIjRFBgcE5mlRJPzgQkvryTe0MTSwMTM zNDcyNTAXEmcty3AJUpIID2xJD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-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20180319053315epcas2p3c61bd9a1bec8d67cde77765842a3205c X-RootMTR: 20180319053315epcas2p3c61bd9a1bec8d67cde77765842a3205c References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is no failure checking on the param value which will be allocated memory by kmalloc. Add a null pointer checking statement. Then goto error: and return -ENOMEM error code when kmalloc is failed. Signed-off-by: Ji-Hun Kim --- Changes since v1: - Return with -ENOMEM directly, instead of goto error: then return. drivers/staging/media/davinci_vpfe/dm365_ipipe.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c index 6a3434c..ffcd86d 100644 --- a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c +++ b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c @@ -1280,6 +1280,9 @@ static int ipipe_s_config(struct v4l2_subdev *sd, struct vpfe_ipipe_config *cfg) params = kmalloc(sizeof(struct ipipe_module_params), GFP_KERNEL); + if (!params) + return -ENOMEM; + to = (void *)params + module_if->param_offset; size = module_if->param_size; @@ -1323,6 +1326,9 @@ static int ipipe_g_config(struct v4l2_subdev *sd, struct vpfe_ipipe_config *cfg) params = kmalloc(sizeof(struct ipipe_module_params), GFP_KERNEL); + if (!params) + return -ENOMEM; + from = (void *)params + module_if->param_offset; size = module_if->param_size; -- 1.9.1