Linux-CIFS Archive mirror
 help / color / mirror / Atom feed
From: dustball <24031212195@stu.xidian.edu.cn>
To: smfrench@gmail.com, linkinjeon@kernel.org, pc@manguebit.org,
	ronniesahlberg@gmail.com, sprasad@microsoft.com, tom@talpey.com,
	bharathsm@microsoft.com, senozhatsky@chromium.org,
	dhowells@redhat.com, chenxiaosong@kylinos.cn,
	chenxiaosong@chenxiaosong.com
Cc: linux-cifs@vger.kernel.org, SunJianHao <24031212195@stu.xidian.edu.cn>
Subject: [PATCH v2 1/1] smb/client: avoid null-ptr-deref when tests fail in test_cmp_map()
Date: Fri,  3 Apr 2026 21:12:05 +0800	[thread overview]
Message-ID: <20260403131206.4716-2-24031212195@stu.xidian.edu.cn> (raw)
In-Reply-To: <20260403131206.4716-1-24031212195@stu.xidian.edu.cn>

From: SunJianHao <24031212195@stu.xidian.edu.cn>

Use KUNIT_ASSERT_NOT_NULL() to abort the test cases on failure.

Reported-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: SunJianHao <24031212195@stu.xidian.edu.cn>
Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
---
 fs/smb/client/smb2maperror_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/smb/client/smb2maperror_test.c b/fs/smb/client/smb2maperror_test.c
index 8c47dea7a2c1..8c4f168c8e99 100644
--- a/fs/smb/client/smb2maperror_test.c
+++ b/fs/smb/client/smb2maperror_test.c
@@ -21,7 +21,7 @@ test_cmp_map(struct kunit *test, const struct status_to_posix_error *expect)
 	const struct status_to_posix_error *result;
 
 	result = smb2_get_err_map_test(expect->smb2_status);
-	KUNIT_EXPECT_PTR_NE(test, NULL, result);
+	KUNIT_ASSERT_NOT_NULL(test, result);
 	KUNIT_EXPECT_EQ(test, expect->smb2_status, result->smb2_status);
 	KUNIT_EXPECT_EQ(test, expect->posix_error, result->posix_error);
 	KUNIT_EXPECT_STREQ(test, expect->status_string, result->status_string);
-- 
2.53.0


      reply	other threads:[~2026-04-03 13:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-03 13:12 [PATCH v2 0/1] smb/client: avoid null-ptr-deref when tests fail in test_cmp_map() dustball
2026-04-03 13:12 ` dustball [this message]

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=20260403131206.4716-2-24031212195@stu.xidian.edu.cn \
    --to=24031212195@stu.xidian.edu.cn \
    --cc=bharathsm@microsoft.com \
    --cc=chenxiaosong@chenxiaosong.com \
    --cc=chenxiaosong@kylinos.cn \
    --cc=dhowells@redhat.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=pc@manguebit.org \
    --cc=ronniesahlberg@gmail.com \
    --cc=senozhatsky@chromium.org \
    --cc=smfrench@gmail.com \
    --cc=sprasad@microsoft.com \
    --cc=tom@talpey.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).