Received: by 10.213.65.68 with SMTP id h4csp166211imn; Thu, 15 Mar 2018 21:59:54 -0700 (PDT) X-Google-Smtp-Source: AG47ELvdPu6jieE6gweb8iQ7t9FCCYLUba7GWuSAmXwGv5jNR5SgwWTJzLWpQaJL3IXammXzTiv9 X-Received: by 10.101.100.9 with SMTP id a9mr384427pgv.209.1521176394826; Thu, 15 Mar 2018 21:59:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521176394; cv=none; d=google.com; s=arc-20160816; b=KfVMsjpmYnQSrwooO83Oy9vZuwwPVzzXTFKMTAc9jY16Bkt6HG2Kqbd5WSxX5n05hF m8CLAl3/gkzTWPaZ8OWJ3ZXWhaQSQicxR56mxkMPkwUlVPOCecnU8+igr3hqUOuqhgcw cc83TcIi3AzO4gcX9ZG8+90s/6MSatFq78EyFGDLnXXNhXXbff+hgye+/Ae1xPFbbTgL Hx7zJcT2NnKdvZXbTp3ThTHuMtSb8oIg7WIcelZ5jGmQLiaHJuNVjSeXMr1C1EQzMhlA IiqAw3XfdxxUNXo3pk03XWzYCSdPMQydfLH6y3Pp3o8xNgC5WwgBHrQJlEMoOgVcRZ4T 3o1Q== 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=CmdwloBy1xty/Jdltdtd39oRR0FjPBWV7W9VfobTrlc=; b=yz8U4MxN/qEqCXNNXwvQm17Sexm2BnlILaL2L5wAJ82sxRlLdpMJOSpp52scMtzhbC kg4kd8qwSVHY/KhBHU9RNb/pHkGh+WOmeREdr4QEKUrc8yxlsqROhr6jbnAc3FpLXUhC 9wGoTo2IKWD/USWXPKhxuAsSQeBsky5fFpYPnsAiBLsw03s3+sCMBpLUNbNIYLoO2fjK pTLsx1+BSdHSDI+aC8sR+yuIMcG1Fri3afx+2lpcOpPQJXbYxXqvIpazQVEH6C5SeFWl 0sWn/N3la8t0EbwpBxPRFqWVq69pkxpeeNLCkzYSvkrWFwJkXD/9th4ImEyX35z4VD8p QOUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=PT2noQ6Y; 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 38-v6si5504013pld.47.2018.03.15.21.59.39; Thu, 15 Mar 2018 21:59:54 -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=PT2noQ6Y; 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 S1751445AbeCPE6r (ORCPT + 99 others); Fri, 16 Mar 2018 00:58:47 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:42008 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750839AbeCPE6o (ORCPT ); Fri, 16 Mar 2018 00:58:44 -0400 Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20180316045842epoutp0392725ea4f58df57c4a446597b9c3afec~cTc4y5VID2363523635epoutp03L; Fri, 16 Mar 2018 04:58:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20180316045842epoutp0392725ea4f58df57c4a446597b9c3afec~cTc4y5VID2363523635epoutp03L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1521176322; bh=CmdwloBy1xty/Jdltdtd39oRR0FjPBWV7W9VfobTrlc=; h=From:To:Cc:Subject:Date:References:From; b=PT2noQ6YEvUBnGM6tNzGaTLSECCureWtFGGTEd8YVqbGQIwkfJAitgOW0z1CTiMQu nTCmF+cXTnv1hYaE/7GIsYt5CY6tvcPILlwvnppoeDfRaRns2PPtDfkosF6IRze5sR jkbWTznKLOaIhuwFT0zynjsyW0rHWoxr+1xkqBeE= Received: from epsmges2p4.samsung.com (unknown [182.195.40.60]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20180316045841epcas1p1c29041309912d1eaeb0abc99b56d6424~cTc4UsG7v1096010960epcas1p1r; Fri, 16 Mar 2018 04:58:41 +0000 (GMT) Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id D6.BE.04080.10F4BAA5; Fri, 16 Mar 2018 13:58:41 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20180316045841epcas2p34dc11231c65e2032e88ac7138db2daee~cTc31UnTA0236702367epcas2p3R; Fri, 16 Mar 2018 04:58:41 +0000 (GMT) X-AuditID: b6c32a48-9adff70000000ff0-9e-5aab4f012149 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 6C.D0.03890.00F4BAA5; Fri, 16 Mar 2018 13:58:41 +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 <0P5O00BL435J8LB0@mmp1.samsung.com>; Fri, 16 Mar 2018 13:58:40 +0900 (KST) From: Ji-Hun Kim To: mchehab@kernel.org 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] staging: media: davinci_vpfe: add error handling on kmalloc failure Date: Fri, 16 Mar 2018 13:58:23 +0900 Message-id: <1521176303-17546-1-git-send-email-ji_hun.kim@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKKsWRmVeSWpSXmKPExsWy7bCmuS6j/+oog/63qhbXehcyW+w584vd onnxejaL/tPbGS223pK2uLxrDptFz4atrBbLNv1hcuDwuLfvMIvHzll32T02repk89g/dw27 R9+WVYwenzfJBbBFpdpkpCampBYppOYl56dk5qXbKnkHxzvHm5oZGOoaWlqYKynkJeam2iq5 +AToumXmAN2jpFCWmFMKFApILC5W0rezKcovLUlVyMgvLrFVijY0NNIzNDDXMzIy0jMxj7Uy MgUqSUjNmHDoOEvBWq6K1492sTQwbuboYuTkkBAwkZg2q5Wpi5GLQ0hgB6PEyX+/oJzvjBKn vv1mhql6dvYtG0RiN6PE0r3zGUESQgI/GCXePXYFsdkENCU2dl8Di4sIiEk82vaKBaSBWeA8 o0TPsUdgk4QFwiROHNjGDmKzCKhKHLz7lwXE5hVwk7jTd5wdYpucxMljk1lBmiUE/rJKdM3+ xQaRcJF49/0ElC0s8er4FqgGaYlnqzYyQtjVEguu7GCBsGskbv5fygRhG0v09lwAO4JZgE+i 4/BfoF4OoDivREebEESJh0THshusELajxKMbn1kgnoyVWDO5iWUCo+QCRoZVjGKpBcW56anF RgUmesWJucWleel6yfm5mxjBSUTLYwfjgXM+hxgFOBiVeHgzmldFCbEmlhVX5h5ilOBgVhLh 9X8GFOJNSaysSi3Kjy8qzUktPsRoCgyOicxSosn5wASXVxJvaGJpYGJmZmhuZGpgriTO2xbg EiUkkJ5YkpqdmlqQWgTTx8TBKdXAWCQ5N6TptFqt++1m6Wgdxe2cegrnZuyeXu6l8kf4acMG mTtvaxc+dvmanHHx9L2Eu1PuZXm+S8/fo39EN8Hr8J7ittOucaF1UZxZSbzFHQUxvNZypp8e zPnw+v358s3bKnYs4m/dsl+XNWDnu5fd2bveLVX5+e7QyV9y0UwHdqp0mwXEsgfvUWIpzkg0 1GIuKk4EAFWdAAg4AwAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHJMWRmVeSWpSXmKPExsVy+t9jAV1G/9VRBns2sVpc613IbLHnzC92 i+bF69ks+k9vZ7TYekva4vKuOWwWPRu2slos2/SHyYHD496+wyweO2fdZffYtKqTzWP/3DXs Hn1bVjF6fN4kF8AWxWWTkpqTWZZapG+XwJUx4dBxloK1XBWvH+1iaWDczNHFyMkhIWAi8ezs W7YuRi4OIYGdjBIzup+zQDg/GCXa57WwglSxCWhKbOy+xghiiwiISTza9gqsiFngPKPE3dnH WUASwgJhEicObGMHsVkEVCUO3v0LFucVcJO403ecHWKdnMTJY5NZJzByLWBkWMUomVpQnJue W2xUYJSXWq5XnJhbXJqXrpecn7uJERgq2w5r9e9gfLwk/hCjAAejEg9vRvOqKCHWxLLiytxD jBIczEoivP7PgEK8KYmVValF+fFFpTmpxYcYpTlYlMR5+fOPRQoJpCeWpGanphakFsFkmTg4 pRoY90QwqCrZspYcfTjr+J73WyXD322Jfbd3sWd17zqbr7Z2i7/NeJB8si+kto6Hk1971brJ ud+sky6pHzW9G5NY17Y8wXGV28oy9aT6mh3lKmeL+W6XvXLbJLsyLuXiqimHwiWUXp1/wmEw wXraEZOZM3iTcy4b5NX9cnF5pd82TarDVMmFs6hAiaU4I9FQi7moOBEAwAoIRxECAAA= X-CMS-MailID: 20180316045841epcas2p34dc11231c65e2032e88ac7138db2daee X-Msg-Generator: CA CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20180316045841epcas2p34dc11231c65e2032e88ac7138db2daee X-RootMTR: 20180316045841epcas2p34dc11231c65e2032e88ac7138db2daee 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 --- drivers/staging/media/davinci_vpfe/dm365_ipipe.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c index 6a3434c..55a922c 100644 --- a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c +++ b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c @@ -1280,6 +1280,10 @@ 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) { + rval = -ENOMEM; + goto error; + } to = (void *)params + module_if->param_offset; size = module_if->param_size; @@ -1323,6 +1327,10 @@ 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) { + rval = -ENOMEM; + goto error; + } from = (void *)params + module_if->param_offset; size = module_if->param_size; -- 1.9.1