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>] [day] [month] [year] [list]
Message-Id: <20230407162257.57163-1-frank.li@vivo.com>
Date:   Sat,  8 Apr 2023 00:22:57 +0800
From:   Yangtao Li <frank.li@...o.com>
To:     Mike Marshall <hubcap@...ibond.com>,
        Martin Brandenburg <martin@...ibond.com>
Cc:     Yangtao Li <frank.li@...o.com>, devel@...ts.orangefs.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH] orangefs: fix error code in orangefs_sysfs_init()

If kzalloc() fails, error code should be ENOMEM.

Signed-off-by: Yangtao Li <frank.li@...o.com>
---
 fs/orangefs/orangefs-sysfs.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/orangefs/orangefs-sysfs.c b/fs/orangefs/orangefs-sysfs.c
index be4ba03a01a0..d349d8ea0593 100644
--- a/fs/orangefs/orangefs-sysfs.c
+++ b/fs/orangefs/orangefs-sysfs.c
@@ -1173,7 +1173,7 @@ static struct kobj_type stats_orangefs_ktype = {
 
 int orangefs_sysfs_init(void)
 {
-	int rc = -EINVAL;
+	int rc = -ENOMEM;
 
 	gossip_debug(GOSSIP_SYSFS_DEBUG, "orangefs_sysfs_init: start\n");
 
@@ -1195,7 +1195,7 @@ int orangefs_sysfs_init(void)
 	/* create /sys/fs/orangefs/acache. */
 	acache_orangefs_obj = kzalloc(sizeof(*acache_orangefs_obj), GFP_KERNEL);
 	if (!acache_orangefs_obj) {
-		rc = -EINVAL;
+		rc = -ENOMEM;
 		goto ofs_obj_bail;
 	}
 
@@ -1213,7 +1213,7 @@ int orangefs_sysfs_init(void)
 	capcache_orangefs_obj =
 		kzalloc(sizeof(*capcache_orangefs_obj), GFP_KERNEL);
 	if (!capcache_orangefs_obj) {
-		rc = -EINVAL;
+		rc = -ENOMEM;
 		goto acache_obj_bail;
 	}
 
@@ -1230,7 +1230,7 @@ int orangefs_sysfs_init(void)
 	ccache_orangefs_obj =
 		kzalloc(sizeof(*ccache_orangefs_obj), GFP_KERNEL);
 	if (!ccache_orangefs_obj) {
-		rc = -EINVAL;
+		rc = -ENOMEM;
 		goto capcache_obj_bail;
 	}
 
@@ -1246,7 +1246,7 @@ int orangefs_sysfs_init(void)
 	/* create /sys/fs/orangefs/ncache. */
 	ncache_orangefs_obj = kzalloc(sizeof(*ncache_orangefs_obj), GFP_KERNEL);
 	if (!ncache_orangefs_obj) {
-		rc = -EINVAL;
+		rc = -ENOMEM;
 		goto ccache_obj_bail;
 	}
 
@@ -1263,7 +1263,7 @@ int orangefs_sysfs_init(void)
 	/* create /sys/fs/orangefs/perf_counters. */
 	pc_orangefs_obj = kzalloc(sizeof(*pc_orangefs_obj), GFP_KERNEL);
 	if (!pc_orangefs_obj) {
-		rc = -EINVAL;
+		rc = -ENOMEM;
 		goto ncache_obj_bail;
 	}
 
@@ -1280,7 +1280,7 @@ int orangefs_sysfs_init(void)
 	/* create /sys/fs/orangefs/stats. */
 	stats_orangefs_obj = kzalloc(sizeof(*stats_orangefs_obj), GFP_KERNEL);
 	if (!stats_orangefs_obj) {
-		rc = -EINVAL;
+		rc = -ENOMEM;
 		goto pc_obj_bail;
 	}
 
-- 
2.35.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ