mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Possible Null pointer dereferences in net/mac80211/parse.c
@ 2025-03-10 14:16 Brahmajit
  2025-03-10 17:09 ` Jeff Johnson
  0 siblings, 1 reply; 2+ messages in thread
From: Brahmajit @ 2025-03-10 14:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-wireless, johannes.berg, ilan.peer, miriam.rachel.korenblit

Coverity Scan reports that there might be a possible NULL pointer
dereferences in net/mac80211/parse.c: 1061 in
ieee802_11_parse_elems_full(). I understand that these reports are not
always correct.

I'm not sure whether the syntax
struct ieee80211_elems_parse_params sub = {};
is correct or falls under C11 standard[0].

initializer:
         assignment-expression
         { initializer-list }
         { initializer-list , }
initializer-list:
         designation(opt) initializer
         initializer-list , designation(opt) initializer

I'm aware that C23 allows empty initialization[1].

braced-initializer:
                    { }
                    { initializer-list }
                    { initializer-list , }

Considering [0], if we do something like

--- a/net/mac80211/parse.c
+++ b/net/mac80211/parse.c
@@ -997,7 +997,7 @@ ieee80211_mle_defrag_epcs(struct ieee80211_elems_parse *elems_parse)
 struct ieee802_11_elems *
 ieee802_11_parse_elems_full(struct ieee80211_elems_parse_params *params)
 {
-       struct ieee80211_elems_parse_params sub = {};
+       struct ieee80211_elems_parse_params sub = { 0 };
        struct ieee80211_elems_parse *elems_parse;
        const struct element *non_inherit = NULL;
        struct ieee802_11_elems *elems;

Would it be incorrect? Would appreciate some feedback.

[0]: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
[1]: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3054.pdf
-- 
Regards,
Brahmajit

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-10 17:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-10 14:16 Possible Null pointer dereferences in net/mac80211/parse.c Brahmajit
2025-03-10 17:09 ` Jeff Johnson

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®