Skip to content

Commit 53cf44f

Browse files
SunJianHaosmfrench
authored andcommitted
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>
1 parent b3f5c2a commit 53cf44f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/smb/client/smb2maperror_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ test_cmp_map(struct kunit *test, const struct status_to_posix_error *expect)
2121
const struct status_to_posix_error *result;
2222

2323
result = smb2_get_err_map_test(expect->smb2_status);
24-
KUNIT_EXPECT_PTR_NE(test, NULL, result);
24+
KUNIT_ASSERT_NOT_NULL(test, result);
2525
KUNIT_EXPECT_EQ(test, expect->smb2_status, result->smb2_status);
2626
KUNIT_EXPECT_EQ(test, expect->posix_error, result->posix_error);
2727
KUNIT_EXPECT_STREQ(test, expect->status_string, result->status_string);

0 commit comments

Comments
 (0)