From patchwork Sun Aug 20 16:42:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9911227 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C9DB4603F3 for ; Sun, 20 Aug 2017 16:42:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAE782875B for ; Sun, 20 Aug 2017 16:42:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AFAB22877F; Sun, 20 Aug 2017 16:42:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 571EF2875B for ; Sun, 20 Aug 2017 16:42:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753191AbdHTQmP (ORCPT ); Sun, 20 Aug 2017 12:42:15 -0400 Received: from mout.web.de ([212.227.17.11]:61967 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753101AbdHTQmO (ORCPT ); Sun, 20 Aug 2017 12:42:14 -0400 Received: from [192.168.1.2] ([92.225.240.160]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0Ma2U7-1e0J473vlX-00Lqwd; Sun, 20 Aug 2017 18:42:13 +0200 Subject: [PATCH 8/8] CIFS: One function call less in cifs_do_create() after error detection From: SF Markus Elfring To: linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, Steve French Cc: LKML , kernel-janitors@vger.kernel.org References: <826310e5-e01c-38af-90df-c5630f761a4d@users.sourceforge.net> Message-ID: <3b7e0d4a-6707-c44f-8775-9e10a291fcd2@users.sourceforge.net> Date: Sun, 20 Aug 2017 18:42:11 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <826310e5-e01c-38af-90df-c5630f761a4d@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:HkSXZpSPZnlWbhrsFoy8BKpUqoV5CdpROUqy990OKELmGRT8a1R UfeGM6rgvEti7jLAa05/y70chyW3L4bHXgwUBFNRMQCW0hYLKETE0gnqoKgGNzeTq0X/6gU LJk1ZbT2X+PBPWo0nmFmZenCdUUXysFtaWqQbyCE/aqS32lhxtwRcewautIBuVKNVrmGcJD Rb0TD55qOGU1vXuvucb5Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:fic4jzoTckQ=:thaCrr54DTcweRJUpZYyY0 C9PexzGm/0Ae/Hdu/jcTrEZq9oqjQ3X47OYZZrJv5oIZ1nNw1BI+VRcn1G+zA7kZizCc+bRAT /erdwVZN9wUFJ7QJkrS7YTmta+C1I2VMePROjV2BldLnRQsFS+6dnCmBEecBfSb5QrWr4irEY wBducid4ppkI4q5arN3UjJYua9cutpkxrWAOMTThR8QLATO2bjWjSFVTA0R9r9qLrYfLcG/J4 FhVKOOAbIY4KsFz3ooJU5Mkm88FxLKa5468H6v1yE3ZJ9YeSi3GKHve6HXgNQpK5sO31O0ah7 S5H7661UcqejqzkAUzXQGoTJmGopn000JqnvT7hvERNfPBD/Bg6Ax4aZHZSqumDKXtwjW5S1I /HdVR0zfrUgFe+mz9j4ZbaoR33Q7ej41e56aZlTae+6gzzaF/P6/2WsVkyJOmTGNJcZ2CZpcM 0I/nD9FBoIRsjx0VnYFAcROVq7hxE+cxN4AYnpMQvTX5HD8DN0DG1TMy5DcYyMgKEWaf5kdq0 l+C8KiGgasw48Lg/S4Z0RrGCoKhL2AzinZzcezNwM4i9YybKEAkJXIv5/zFveqo5O1Ms/9vLm tHH/Yg66naWU836T14YQ1W0oLLksObvRks9iK7Z3wtAtNolWIw88g5siat5PbJE/PIPmypXrk xpEbB23/2XggfuwvJqLkIOC8PVhJcdHOYCqg/KIK5KoF8ch8EUT2RGeTs1SwnYSc+DMn30qDp hbcS7YtmEuhy45w6u1GQ34HIgqAVwkYpYYF0EdKdl3orvVLcE0GT3ylrR54oQ+YPlVxiHNHwc FWqSC/mn/GTOoA8LaxRR0N8uXEH5kvebhvsrjRqINCUHRR3e5k= Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sun, 20 Aug 2017 17:47:44 +0200 The kfree() function was called in a few cases by the cifs_do_create() function during error handling even if the passed variable contained a null pointer. Add a jump target according to the Linux coding style convention. Signed-off-by: Markus Elfring --- fs/cifs/dir.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 69babcf4f653..73e68aa5326e 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c @@ -258,7 +258,7 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid, CIFSSMBClose(xid, tcon, fid->netfid); iput(newinode); rc = -EISDIR; - goto out; + goto free_path; } if (!S_ISREG(newinode->i_mode)) { @@ -301,7 +301,7 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid, break; default: - goto out; + goto free_path; } /* * fallthrough to retry, using older open call, this is case @@ -334,13 +334,13 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid, if (!server->ops->open) { rc = -ENOSYS; - goto out; + goto free_path; } buf = kmalloc(sizeof(*buf), GFP_KERNEL); if (buf == NULL) { rc = -ENOMEM; - goto out; + goto free_path; } /* @@ -444,6 +444,7 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid, out: kfree(buf); +free_path: kfree(full_path); return rc;