Received: by 10.213.65.68 with SMTP id h4csp956749imn; Tue, 20 Mar 2018 21:41:35 -0700 (PDT) X-Google-Smtp-Source: AG47ELukIq0eFiGY9y43/astQS200L5gSWybGlA6E2HqUcAY3gc0tXlweftZRQaTdNb6zIryKMcS X-Received: by 10.98.200.9 with SMTP id z9mr9738979pff.128.1521607295490; Tue, 20 Mar 2018 21:41:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521607295; cv=none; d=google.com; s=arc-20160816; b=DBoO+9mj3flfQSPxzbTc3oKw1N46ccZa2KwV0vaj+33VTUUt0A7/62+mrLUuYf7qMu 0QnkFGvf+e9RVJ+7ZXiiV2biK0m6et/7d7wlvcOLXevLPF61uzrvONE8fZZwsUHTS5em ey0zNtIJiZCsIs3UsJMWAbHZfGIf8r+SQYdj8MxfFwGqXBQZr4r2A5IKUnpo/hxPsAzl 2ADPoRbIlmX9bboIByr5ODQt6xqq/zmuvgYKhLTFFLdCf0tXD9ow0b0Pz1RvSgCyeQA7 JIIXeAKJ0GvoNkko5U2Dp8wfbsNsGDj+5yyXPjp1oB7wtc38OmX7tWAF1CUVHCoOoq1q j5EA== 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 :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :dkim-filter:arc-authentication-results; bh=aDuJyjhksWleyhhzPEhHDt34lkFvALbkwRyPJxYp2+A=; b=ZIczoSWwzovyDupsq/IudvjL6opXEOBP0P3iPfxeGeKvACWPJhAaxkFD5LlSApjy6V EGcLPNJeqlSkAhG9OdKh4lb/ODwTquU1G1S12HSODhxfZv/lcNULw2cCmq7jiRq7xfqE i5AJWSR2HKgv9L7v+LLCKMYaCLyJFrvMNAnbQ698HESanIzQmjp3R+gb73BrELEBk+ld Dw+h+zkpUlOu7BIFsNngQx9O/5YY2ib398lueFJn2kU3S+T8qmel2fVkTCFCS4ecHjZk UNSfXkrVTmtRDDUSswqw5KBQG4jKOiC/fjyK9P+bBNniWxtLCP5R1Spg2zuNl5V9mF0a +R+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=brImZq+G; 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 g1si2211387pgq.219.2018.03.20.21.41.21; Tue, 20 Mar 2018 21:41:35 -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=brImZq+G; 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 S1751940AbeCUEjd (ORCPT + 99 others); Wed, 21 Mar 2018 00:39:33 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:19762 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751719AbeCUEjV (ORCPT ); Wed, 21 Mar 2018 00:39:21 -0400 Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20180321043919epoutp021efe184fdca151a9297de80df96a0ec2~d1aZB3R2d2258522585epoutp02J; Wed, 21 Mar 2018 04:39:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20180321043919epoutp021efe184fdca151a9297de80df96a0ec2~d1aZB3R2d2258522585epoutp02J DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1521607159; bh=aDuJyjhksWleyhhzPEhHDt34lkFvALbkwRyPJxYp2+A=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=brImZq+GSVgcVPZL7fMEU3p6A+Na82uo+Fad5SsurGHWRcGuIGjxqlae2BEUXcagB R1JhXKc0Y3BGTFx6BZbLGcKM0f8TAU0bRK6TsO/lYsgC3Ih/nnh/iuAyy85kh+3wwI 5D76wehZnCfThf24Tynd8zZdchntmP9oDcpRa8BY= Received: from epsmges2p4.samsung.com (unknown [182.195.40.60]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20180321043918epcas1p29da86a27eb2209bc51e9d200bf2c5035~d1aYm77ir1233412334epcas1p2T; Wed, 21 Mar 2018 04:39:18 +0000 (GMT) Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id E1.25.04080.6F1E1BA5; Wed, 21 Mar 2018 13:39:18 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20180321043918epcas2p3d7cc4cf4c6377171c53af63ff3aa2a9a~d1aYTnSV82141321413epcas2p3N; Wed, 21 Mar 2018 04:39:18 +0000 (GMT) X-AuditID: b6c32a48-9adff70000000ff0-45-5ab1e1f6b81a Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id C5.AC.03890.6F1E1BA5; Wed, 21 Mar 2018 13:39:18 +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:18 +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 2/2] staging: media: davinci_vpfe: add kfree() on goto err statement Date: Wed, 21 Mar 2018 13:39:10 +0900 Message-id: <1521607150-31307-2-git-send-email-ji_hun.kim@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1521607150-31307-1-git-send-email-ji_hun.kim@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLKsWRmVeSWpSXmKPExsWy7bCmqe63hxujDDZdVra41ruQ2eL1v+ks FnvO/GK3aF68ns2i//R2Routt6QtLu+aw2bRs2Erq8WyTX+YHDg97u07zOKxc9Zddo9NqzrZ PPbPXcPu8fHpLRaPvi2rGD0+b5ILYI9KtclITUxJLVJIzUvOT8nMS7dV8g6Od443NTMw1DW0 tDBXUshLzE21VXLxCdB1y8wBukxJoSwxpxQoFJBYXKykb2dTlF9akqqQkV9cYqsUbWhopGdo YK5nZGSkZ2Iea2VkClSSkJqxo/EJW8EOiYpJl1+xNDB+FOpi5OSQEDCRaGm5yNbFyMUhJLCD UeL21PXsEM53RolHl6+ywlQ9fXcEqmo3o8SMmxOhqn4wSvR8PgZWxSagKbGx+xojiC0iYCBx 7eZbVpAiZoHzQEXHHjGDJIQFIiUOztrLBmKzCKhKHNt7BayZV8BNYu/0nywQ6+QkTh6bDBbn FHCXuDV9H9hqCYEVbBL7NkxngihykTj1ZQkjhC0s8er4FnYIW1ri2aqNUPFqiQVXdkANrZG4 +X8pVK+xRG/PBbCDmAX4JDoO/wXq5QCK80p0tEEDxkOip+seM4TtKNG3+CkLxMezGCXe9ney TGCUWsDIsIpRLLWgODc9tdiowESvODG3uDQvXS85P3cTIzjpaHnsYDxwzucQowAHoxIP7wSJ jVFCrIllxZW5hxglOJiVRHgPRQCFeFMSK6tSi/Lji0pzUosPMZoCw2Yis5Rocj4wIeaVxBua WBqYmJkZmhuZGpgrifO2BbhECQmkJ5akZqemFqQWwfQxcXBKNTDG3j1//wTnuYq9LTwP2fgW dou3lsvkdpkZi9ZF+zRbrW049O1x97L5XAd+v96TXC4uqWfFs1xPTKVR/nF2+qJM4Ss+9fUq /ue+ih/LzHZ+wHXyLUdIaJhZTtiuefk+kYoJiZ+LPwf+zt7S8ynNwlLy36d/YQvlHtx9HHRw p9bstvkn1f8eXK7EUpyRaKjFXFScCAD+uW+SUAMAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPLMWRmVeSWpSXmKPExsVy+t9jAd1vDzdGGRyZK2ZxrXchs8Xrf9NZ LPac+cVu0bx4PZtF/+ntjBZbb0lbXN41h82iZ8NWVotlm/4wOXB63Nt3mMVj56y77B6bVnWy eeyfu4bd4+PTWywefVtWMXp83iQXwB7FZZOSmpNZllqkb5fAlbGj8QlbwQ6JikmXX7E0MH4U 6mLk5JAQMJF4+u4IG4gtJLCTUWLdd8MuRi4g+wejxNV//awgCTYBTYmN3dcYQWwRAQOJazff soIUMQucZ5S4O/s4C0hCWCBSov/EFrAGFgFViWN7r4DZvAJuEnun/2SB2CYncfLYZLA4p4C7 xK3p+6A2u0mcmbWGbQIjzwJGhlWMkqkFxbnpucVGBUZ5qeV6xYm5xaV56XrJ+bmbGIHBtu2w Vv8OxsdL4g8xCnAwKvHwWohtjBJiTSwrrsw9xCjBwawkwnsoAijEm5JYWZValB9fVJqTWnyI UZqDRUmclz//WKSQQHpiSWp2ampBahFMlomDU6qB0XXevDZL37U80yLlWiMSXiWvirjOtEB5 2ysbFU+tnc9qruetSRbb73WuYH644afHu/nXd/74/+iizZIN/vGF3ap6XOpBDC5sW01Ot+y4 vITrmNoE19TP0z9MvrTb6NjkwvubPeZeij8utv76l83TF6UFBEQkb4yY9WDR7t9r53749iFz 0eOwgA1KLMUZiYZazEXFiQCNjhH1MgIAAA== X-CMS-MailID: 20180321043918epcas2p3d7cc4cf4c6377171c53af63ff3aa2a9a X-Msg-Generator: CA CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20180321043918epcas2p3d7cc4cf4c6377171c53af63ff3aa2a9a X-RootMTR: 20180321043918epcas2p3d7cc4cf4c6377171c53af63ff3aa2a9a References: <1521607150-31307-1-git-send-email-ji_hun.kim@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It needs to free of allocated params value in the goto error statement. Signed-off-by: Ji-Hun Kim --- Changes since v2: - add kfree(params) on the error case of the function - rename unclear goto statement name - declare the params value at start of the function, so it can be free end of the function drivers/staging/media/davinci_vpfe/dm365_ipipe.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c index ffcd86d..735d8b5 100644 --- a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c +++ b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c @@ -1263,6 +1263,7 @@ static int ipipe_get_cgs_params(struct vpfe_ipipe_device *ipipe, void *param) static int ipipe_s_config(struct v4l2_subdev *sd, struct vpfe_ipipe_config *cfg) { struct vpfe_ipipe_device *ipipe = v4l2_get_subdevdata(sd); + struct ipipe_module_params *params; unsigned int i; int rval = 0; @@ -1272,7 +1273,6 @@ static int ipipe_s_config(struct v4l2_subdev *sd, struct vpfe_ipipe_config *cfg) if (cfg->flag & bit) { const struct ipipe_module_if *module_if = &ipipe_modules[i]; - struct ipipe_module_params *params; void __user *from = *(void * __user *) ((void *)cfg + module_if->config_offset); size_t size; @@ -1289,26 +1289,30 @@ static int ipipe_s_config(struct v4l2_subdev *sd, struct vpfe_ipipe_config *cfg) if (to && from && size) { if (copy_from_user(to, from, size)) { rval = -EFAULT; - break; + goto err_free_params; } rval = module_if->set(ipipe, to); if (rval) - goto error; + goto err_free_params; } else if (to && !from && size) { rval = module_if->set(ipipe, NULL); if (rval) - goto error; + goto err_free_params; } kfree(params); } } -error: + return 0; + +err_free_params: + kfree(params); return rval; } static int ipipe_g_config(struct v4l2_subdev *sd, struct vpfe_ipipe_config *cfg) { struct vpfe_ipipe_device *ipipe = v4l2_get_subdevdata(sd); + struct ipipe_module_params *params; unsigned int i; int rval = 0; @@ -1318,7 +1322,6 @@ static int ipipe_g_config(struct v4l2_subdev *sd, struct vpfe_ipipe_config *cfg) if (cfg->flag & bit) { const struct ipipe_module_if *module_if = &ipipe_modules[i]; - struct ipipe_module_params *params; void __user *to = *(void * __user *) ((void *)cfg + module_if->config_offset); size_t size; @@ -1335,16 +1338,19 @@ static int ipipe_g_config(struct v4l2_subdev *sd, struct vpfe_ipipe_config *cfg) if (to && from && size) { rval = module_if->get(ipipe, from); if (rval) - goto error; + goto err_free_params; if (copy_to_user(to, from, size)) { rval = -EFAULT; - break; + goto err_free_params; } } kfree(params); } } -error: + return 0; + +err_free_params: + kfree(params); return rval; } -- 1.9.1