mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: David Disseldorp <ddiss@suse.de>
Cc: Christian Brauner <brauner@kernel.org>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH next] initramfs_test: Fix NULL vs IS_ERR() bug in initramfs_test_data()
Date: Thu, 6 Mar 2025 12:48:40 +0300	[thread overview]
Message-ID: <a4ed49c0-e92f-4fa6-b1b2-32749f551724@stanley.mountain> (raw)

The filp_open() function returns error pointers.  It never returns
NULL pointers.  Update the check to match.

Fixes: b6736cfccb58 ("initramfs_test: kunit tests for initramfs unpacking")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 init/initramfs_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/init/initramfs_test.c b/init/initramfs_test.c
index 6231fe012583..7d14f70beabc 100644
--- a/init/initramfs_test.c
+++ b/init/initramfs_test.c
@@ -222,7 +222,7 @@ static void __init initramfs_test_data(struct kunit *test)
 	KUNIT_EXPECT_NULL(test, err);
 
 	file = filp_open(c[0].fname, O_RDONLY, 0);
-	if (!file) {
+	if (IS_ERR(file)) {
 		KUNIT_FAIL(test, "open failed");
 		goto out;
 	}
-- 
2.47.2


             reply	other threads:[~2025-03-06  9:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-06  9:48 Dan Carpenter [this message]
2025-03-06  9:52 ` Christian Brauner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a4ed49c0-e92f-4fa6-b1b2-32749f551724@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=brauner@kernel.org \
    --cc=ddiss@suse.de \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®