lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fc35a4b0-9a41-4f14-9558-99fc0b7e2ad8@web.de>
Date: Thu, 26 Sep 2024 11:50:40 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: linux-mtd@...ts.infradead.org, Richard Weinberger <richard@....at>,
 Zhihao Cheng <chengzhihao1@...wei.com>
Cc: LKML <linux-kernel@...r.kernel.org>, kernel-janitors@...r.kernel.org
Subject: [PATCH 2/2] ubifs: Reduce kfree() calls in ubifs_purge_xattrs()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Thu, 26 Sep 2024 11:28:48 +0200

Move a pair of kfree() calls behind the label “out_err”
so that two statements can be better reused at the end of
this function implementation.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 fs/ubifs/xattr.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
index 7757959e9f09..a514dc4dc535 100644
--- a/fs/ubifs/xattr.c
+++ b/fs/ubifs/xattr.c
@@ -532,8 +532,6 @@ int ubifs_purge_xattrs(struct inode *host)
 			ubifs_err(c, "dead directory entry '%s', error %d",
 				  xent->name, err);
 			ubifs_ro_mode(c, err);
-			kfree(pxent);
-			kfree(xent);
 			goto out_err;
 		}

@@ -543,8 +541,6 @@ int ubifs_purge_xattrs(struct inode *host)
 		err = remove_xattr(c, host, xino, &nm);
 		iput(xino);
 		if (err) {
-			kfree(pxent);
-			kfree(xent);
 			ubifs_err(c, "cannot remove xattr, error %d", err);
 			goto out_err;
 		}
@@ -564,6 +560,8 @@ int ubifs_purge_xattrs(struct inode *host)
 	return 0;

 out_err:
+	kfree(pxent);
+	kfree(xent);
 	up_write(&ubifs_inode(host)->xattr_sem);
 	return err;
 }
--
2.46.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ