public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH next] efivarfs: Fix a NULL vs IS_ERR() bug
@ 2025-01-13  6:15 Dan Carpenter
  2025-01-13 14:18 ` Ard Biesheuvel
  2025-01-14 17:11 ` Markus Elfring
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2025-01-13  6:15 UTC (permalink / raw)
  To: James Bottomley
  Cc: Jeremy Kerr, Ard Biesheuvel, linux-efi, linux-kernel,
	kernel-janitors

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 --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;
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH next] efivarfs: Fix a NULL vs IS_ERR() bug
  2025-01-13  6:15 [PATCH next] efivarfs: Fix a NULL vs IS_ERR() bug Dan Carpenter
@ 2025-01-13 14:18 ` Ard Biesheuvel
  2025-01-13 14:25   ` Dan Carpenter
  2025-01-14 17:11 ` Markus Elfring
  1 sibling, 1 reply; 4+ messages in thread
From: Ard Biesheuvel @ 2025-01-13 14:18 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: James Bottomley, Jeremy Kerr, linux-efi, linux-kernel,
	kernel-janitors

On Mon, 13 Jan 2025 at 07:16, Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> 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(-)
>

Thanks - I'll fold this in rather than apply it on top though.

> 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;
> --
> 2.45.2
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH next] efivarfs: Fix a NULL vs IS_ERR() bug
  2025-01-13 14:18 ` Ard Biesheuvel
@ 2025-01-13 14:25   ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2025-01-13 14:25 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: James Bottomley, Jeremy Kerr, linux-efi, linux-kernel,
	kernel-janitors

On Mon, Jan 13, 2025 at 03:18:05PM +0100, Ard Biesheuvel wrote:
> On Mon, 13 Jan 2025 at 07:16, Dan Carpenter <dan.carpenter@linaro.org> wrote:
> >
> > 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(-)
> >
> 
> Thanks - I'll fold this in rather than apply it on top though.

Sure.  No worries.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH next] efivarfs: Fix a NULL vs IS_ERR() bug
  2025-01-13  6:15 [PATCH next] efivarfs: Fix a NULL vs IS_ERR() bug Dan Carpenter
  2025-01-13 14:18 ` Ard Biesheuvel
@ 2025-01-14 17:11 ` Markus Elfring
  1 sibling, 0 replies; 4+ messages in thread
From: Markus Elfring @ 2025-01-14 17:11 UTC (permalink / raw)
  To: Dan Carpenter, linux-efi, Ard Biesheuvel, James Bottomley
  Cc: kernel-janitors, LKML, Jeremy Kerr

> The kernel_file_open() function doesn't return NULL, it retursn error

                                                          returns?


> pointers.  Fix the error checking to match.


Regards,
Markus

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-01-14 17:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-13  6:15 [PATCH next] efivarfs: Fix a NULL vs IS_ERR() bug Dan Carpenter
2025-01-13 14:18 ` Ard Biesheuvel
2025-01-13 14:25   ` Dan Carpenter
2025-01-14 17:11 ` Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox