# \[PATCH -next\] apparmor: Use IS\_ERR\_OR\_NULL() helper function

- From: Hongbo Li \<hidden\>
- Date: 2024-08-28 12:18:26 
- List: linux-security-module
- Page: https://ratatoskr.run/linux-security-module/2024/08/16284394
- Thread: https://ratatoskr.run/linux-security-module/2024/08/16284394/t.md

```text
Use the IS_ERR_OR_NULL() helper instead of open-coding a
NULL and an error pointer checks to simplify the code and
improve readability.

Signed-off-by: Hongbo Li <redacted>
---
 security/apparmor/path.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/apparmor/path.c b/security/apparmor/path.c
index 45ec994b558d..d6c74c357ffd 100644
--- a/security/apparmor/path.c
+++ b/security/apparmor/path.c
@@ -130,7 +130,7 @@ static int d_namespace_path(const struct path *path, char *buf, char **name,
 	/* handle error conditions - and still allow a partial path to
 	 * be returned.
 	 */
-	if (!res || IS_ERR(res)) {
+	if (IS_ERR_OR_NULL(res)) {
 		if (PTR_ERR(res) == -ENAMETOOLONG) {
 			error = -ENAMETOOLONG;
 			*name = buf;
-- 
2.34.1

```
