From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753284AbdHTQmQ (ORCPT ); Sun, 20 Aug 2017 12:42:16 -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 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-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.14.0