Skip to content

Commit 13c4f77

Browse files
Gax-cjmberg-intel
authored andcommitted
wifi: cfg80211: tests: Fix potential NULL dereference in test_cfg80211_parse_colocated_ap()
kunit_kzalloc() may return NULL, dereferencing it without NULL check may lead to NULL dereference. Add a NULL check for ies. Fixes: 45d4393 ("wifi: cfg80211: add a kunit test for 6 GHz colocated AP parsing") Signed-off-by: Zichen Xie <zichenxie0106@gmail.com> Link: https://patch.msgid.link/20241115063835.5888-1-zichenxie0106@gmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 8e66f6c commit 13c4f77

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/wireless/tests/scan.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,8 @@ static void test_cfg80211_parse_colocated_ap(struct kunit *test)
810810
skb_put_data(input, "123", 3);
811811

812812
ies = kunit_kzalloc(test, struct_size(ies, data, input->len), GFP_KERNEL);
813+
KUNIT_ASSERT_NOT_NULL(test, ies);
814+
813815
ies->len = input->len;
814816
memcpy(ies->data, input->data, input->len);
815817

0 commit comments

Comments
 (0)