diff mbox series

[next] efivarfs: Fix a NULL vs IS_ERR() bug

Message ID 7f7565d8-ef9f-4e5f-834b-9735db01835a@stanley.mountain
State New
Headers show
Series [next] efivarfs: Fix a NULL vs IS_ERR() bug | expand

Commit Message

Dan Carpenter Jan. 13, 2025, 6:15 a.m. UTC
The kernel_file_open() function doesn't return NULL, it retursn error
pointers.  Fix the error checking to match.

Fixes: eb11e99adef8 ("efivarfs: add variable resync after hibernation")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 fs/efivarfs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c
index 961264f628dc..968e4af7b7e4 100644
--- a/fs/efivarfs/super.c
+++ b/fs/efivarfs/super.c
@@ -492,7 +492,7 @@  static int efivarfs_pm_notify(struct notifier_block *nb, unsigned long action,
 	/* O_NOATIME is required to prevent oops on NULL mnt */
 	file = kernel_file_open(&path, O_RDONLY | O_DIRECTORY | O_NOATIME,
 				current_cred());
-	if (!file)
+	if (IS_ERR(file))
 		return NOTIFY_DONE;
 
 	rescan_done = true;