diff options
| author | SunJianHao <24031212195@stu.xidian.edu.cn> | 2026-04-03 16:12:05 +0300 |
|---|---|---|
| committer | Steve French <stfrench@microsoft.com> | 2026-04-06 03:58:40 +0300 |
| commit | 53cf44fa727113affda4a17207a54e0d27c7fc78 (patch) | |
| tree | 177b70d40fc2395af841f02b148558d5b8b81147 | |
| parent | b3f5c2a41a0d0d2efbfb4dcdcdc086856562b28b (diff) | |
| download | linux-53cf44fa727113affda4a17207a54e0d27c7fc78.tar.xz | |
smb/client: avoid null-ptr-deref when tests fail in test_cmp_map()
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>
Signed-off-by: Steve French <stfrench@microsoft.com>
| -rw-r--r-- | fs/smb/client/smb2maperror_test.c | 2 |
1 files changed, 1 insertions, 1 deletions
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); |
