Received: by 10.213.65.68 with SMTP id h4csp956356imn; Tue, 20 Mar 2018 21:40:38 -0700 (PDT) X-Google-Smtp-Source: AG47ELvtaR+MmwVKAqRmTnoVSNafJW3BK5xy2GvhHjbt4LbqUxEKkBjXQfLZkXIJfos/riXLCXtl X-Received: by 2002:a17:902:8c93:: with SMTP id t19-v6mr3424052plo.301.1521607238107; Tue, 20 Mar 2018 21:40:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521607238; cv=none; d=google.com; s=arc-20160816; b=WoT++ViJymEhCNt67Bi8ZdGA98YqZy2jh5MHIn32BOUUkC3eZ0jc7eQWnps6Rk/slN l7c+7pll+hiEiV4zxLrbP6cpF3mPgN1ikV8Hj+3zZl7iSHmpjsIGB0KuNHhi8vJWTYSc +MifHzzLkAWkUgXDTuCZHdGkF7wbvEmcoXc21bipmhyN/EeGwpX3LrPPMo/BlTKhfddT z9U5IJNBiFsn4CjNoXtZ00XzycTIe/MtAikPjqzWtowu9XUO3II6+2n+ToCC2oIALXej iir24DkyJ8Ejg/ABCNf5WBbV3evrZ/3esvyibwWTj29xYqFOo07wxg6AsOSJKiXNILgt Pwhg== 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=UWe3L4G08au662iMUn+aQXaJ41lm+9hl7xQPgURO0YU=; b=eINdhv379yKjhGDl8USD/TJu578yAggaH+vvEZTuQ+9diwsYh0so3x/X+I7qezGhCP MIDaqY3jP3bUsmeWy8q2Cfi9PmhZ69Ft5PrPKNAdbsDIy10SamwBFFm9/sxNaTUcMsbe 3iuj79fBkZ2Q6O+sXCuTk1P3MPIkXJiSaYVsOSUl3w0zHsNhot2I3DKNPZxxc+feT0ch 2cN8tMUBRy26x8WtUMdF/xnlR+mbOhuFlQjR2kZrTP8IePpbJk61JxiGeOZA9wl2ssrJ 3nfwpbM89U7op8cvv8gM3N8LjE3o79MwCyS7uq26tLp4i7Yh6yZxC18Dz8x+/yQV9Q2f XVEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=lsquGteU; 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 h22-v6si3060244plr.668.2018.03.20.21.40.24; Tue, 20 Mar 2018 21:40:38 -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=lsquGteU; 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 S1751890AbeCUEjW (ORCPT + 99 others); Wed, 21 Mar 2018 00:39:22 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:26054 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751629AbeCUEjS (ORCPT ); Wed, 21 Mar 2018 00:39:18 -0400 Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20180321043916epoutp01da106fb1e29ad2a2dac4b314a004a44e~d1aWrK35-0092400924epoutp01s; Wed, 21 Mar 2018 04:39:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20180321043916epoutp01da106fb1e29ad2a2dac4b314a004a44e~d1aWrK35-0092400924epoutp01s DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1521607156; bh=UWe3L4G08au662iMUn+aQXaJ41lm+9hl7xQPgURO0YU=; h=From:To:Cc:Subject:Date:References:From; b=lsquGteUSxlrIr8MrvOX0rlN/7qMFxJiORBCdWgckejvwa7vjD5jdIOkOG2qY2zbd wFlTRoKKOQDf4mNyUnP3s2K5mmtUhgC34xdOWKS02dciR6z+la0/KCls+e8n4qJvMV 4X8kiANI/xW5fmjQj2KzSN3z1VXpSj48+YEYu2r0= Received: from epsmges1p1.samsung.com (unknown [182.195.40.92]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20180321043916epcas1p42e1f22538c72f6483b45b2b3d8905976~d1aWWm_GP2176021760epcas1p4x; Wed, 21 Mar 2018 04:39:16 +0000 (GMT) Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmges1p1.samsung.com (Symantec Messaging Gateway) with SMTP id 93.BB.04145.3F1E1BA5; Wed, 21 Mar 2018 13:39:15 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20180321043915epcas1p3955f5a57c6728cd1f386f805879fc3f2~d1aVrGZq42123321233epcas1p3D; Wed, 21 Mar 2018 04:39:15 +0000 (GMT) X-AuditID: b6c32a35-891ff70000001031-79-5ab1e1f3cc94 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 4D.A5.03826.3F1E1BA5; Wed, 21 Mar 2018 13:39: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 <0P5X007KUBLCEK20@mmp1.samsung.com>; Wed, 21 Mar 2018 13:39:15 +0900 (KST) From: Ji-Hun Kim To: dan.carpenter@oracle.com, 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 v3 1/2] staging: media: davinci_vpfe: add error handling on kmalloc failure Date: Wed, 21 Mar 2018 13:39:09 +0900 Message-id: <1521607150-31307-1-git-send-email-ji_hun.kim@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrHKsWRmVeSWpSXmKPExsWy7bCmnu7nhxujDCY2mVhc613IbPH633QW iz1nfrFbNC9ez2bRf3o7o8XWW9IWl3fNYbPo2bCV1WLZpj9MDpwe9/YdZvHYOesuu8emVZ1s HvvnrmH3+Pj0FotH35ZVjB6fN8kFsEel2mSkJqakFimk5iXnp2TmpdsqeQfHO8ebmhkY6hpa WpgrKeQl5qbaKrn4BOi6ZeYAXaakUJaYUwoUCkgsLlbSt7Mpyi8tSVXIyC8usVWKNjQ00jM0 MNczMjLSMzGPtTIyBSpJSM14secte0Ejd8W7G8INjP85uhg5OSQETCTeP5rD1sXIxSEksINR 4v7u2SwQzndGidfrzrLDVG1795URIrGbUeLB4cOsEM4PRomdm2ayglSxCWhKbOy+xghiiwgY SFy7+RasiFngPKNEz7FHzCAJYYFYiaezJ4DZLAKqEnt+NTCB2LwCbhLPpt1ngVgnJ3Hy2GSw ZgmBHjaJhc9+M0EkXCRezrsPdZOwxKvjW4BsDiBbWuLSUVuIcLXEgis7oObUSNz8vxSq1Vii t+cC2F5mAT6Jd197WCFaeSU62oQgSjwk/r/7wAhhO0pcmT0LbJMQ0MlL5rUzT2CUXMDIsIpR LLWgODc9tdiwwFCvODG3uDQvXS85P3cTIzitaJnuYJxyzucQowAHoxIP7wSJjVFCrIllxZW5 hxglOJiVRHgPRQCFeFMSK6tSi/Lji0pzUosPMZoCQ2Mis5Rocj4w5eWVxBuaWBqYmBmZmhoa WJgoifMGBLhECQmkJ5akZqemFqQWwfQxcXBKNTDuttswu0vtS/ZPNw+XL7GTNqtq8140XV+0 72u64PYYoz89FtFTF3Gs0Z2Rx3pmdc69ixtutP42vrRqYUTfDo/MU4x9txWl3I7XGN73+i3z J/rMSpPrPIrPEzmZIgNW+uSmvw7ZuOXmm6mHP7f9KrhW8q9F//3LUIfDAWIPX11XOJ14tUl0 wu+3SizFGYmGWsxFxYkABlEtfUEDAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpjluLIzCtJLcpLzFFi42I5/e+xgO7nhxujDHoey1lc613IbPH633QW iz1nfrFbNC9ez2bRf3o7o8XWW9IWl3fNYbPo2bCV1WLZpj9MDpwe9/YdZvHYOesuu8emVZ1s HvvnrmH3+Pj0FotH35ZVjB6fN8kFsEdx2aSk5mSWpRbp2yVwZbzY85a9oJG74t0N4QbG/xxd jJwcEgImEtvefWUEsYUEdjJKvFkR3cXIBWT/YJT4/OMUWIJNQFNiY/c1MFtEwEDi2s23rCBF zALnGSXuzj7OApIQFoiVeDp7AjOIzSKgKrHnVwMTiM0r4CbxbNp9FohtchInj01mncDItYCR YRWjZGpBcW56brFRgWFearlecWJucWleul5yfu4mRmDobDus1beD8f6S+EOMAhyMSjy8FmIb o4RYE8uKK3MPMUpwMCuJ8B6KAArxpiRWVqUW5ccXleakFh9ilOZgURLnvZ13LFJIID2xJDU7 NbUgtQgmy8TBKdXA2PWb73tdCF//FC/RHS6XQ2WfaLXNmqYo+M+e0/T8xKk3lnqsE0/vD9QI Kdt4M8/tJkf75LYFZe/Kz/o5cRU2/g9rXebVO6/ga94lo8Dv9wy8U+rT3Kb1+Yie4Im7YXTD dMqcNZsfp9wu6jrz5+3nj8sC78tO26n89WfKn0+sNz/Vbvrlkj+nRImlOCPRUIu5qDgRALWq k1wZAgAA X-CMS-MailID: 20180321043915epcas1p3955f5a57c6728cd1f386f805879fc3f2 X-Msg-Generator: CA CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20180321043915epcas1p3955f5a57c6728cd1f386f805879fc3f2 X-RootMTR: 20180321043915epcas1p3955f5a57c6728cd1f386f805879fc3f2 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. - [Patch v3 1/2] is same with [patch v2] 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