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-next>] [day] [month] [year] [list]
Message-ID: <7627f2b9-2287-46d2-b461-d33aa69931a8@moroto.mountain>
Date:   Tue, 20 Jun 2023 11:06:34 +0300
From:   Dan Carpenter <dan.carpenter@...aro.org>
To:     Ivan Orlov <ivan.orlov0322@...il.com>,
        Immad Mir <mirimmad17@...il.com>
Cc:     WANG Xuerui <kernel@...0n.name>,
        Huacai Chen <chenhuacai@...nel.org>, loongarch@...ts.linux.dev,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH] LoongArch: Delete debugfs checking

Debugfs functions are not supposed to be checked for errors.  This
is sort of unusual but it is described in the comments for the
debugfs_create_dir() function.  Also debugfs_create_dir() can never
return NULL.

Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
---
I spotted this code because I was looking at patches which were sent
to stable but without a Fixes tag.  The correct way of checking for
error pointers is not IS_ERR_OR_NULL(), it's IS_ERR().  When a function
returns both error pointers and NULL, the NULL should be treated as a
special kind of success.  Please see my blog for more details.

https://staticthinking.wordpress.com/2022/08/01/mixing-error-pointers-and-null/

I have not included a Fixes tag here, because it's not really a bug fix,
it's just a clean up.

 arch/loongarch/kernel/unaligned.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/loongarch/kernel/unaligned.c b/arch/loongarch/kernel/unaligned.c
index 85fae3d2d71a..3abf163dda05 100644
--- a/arch/loongarch/kernel/unaligned.c
+++ b/arch/loongarch/kernel/unaligned.c
@@ -485,8 +485,6 @@ static int __init debugfs_unaligned(void)
 	struct dentry *d;
 
 	d = debugfs_create_dir("loongarch", NULL);
-	if (IS_ERR_OR_NULL(d))
-		return -ENOMEM;
 
 	debugfs_create_u32("unaligned_instructions_user",
 				S_IRUGO, d, &unaligned_instructions_user);
-- 
2.39.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ