Make get_mode() easier for static analyzers

Add an explicit check for modes != NULL instead of depending on
num_modes > 0 implying that. This is to silence invalid static analyzer
reports.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2021-09-30 18:23:26 +03:00 committed by Jouni Malinen
parent 9e46b31273
commit 857c4dfa83

View file

@ -8232,6 +8232,9 @@ struct hostapd_hw_modes * get_mode(struct hostapd_hw_modes *modes,
{
u16 i;
if (!modes)
return NULL;
for (i = 0; i < num_modes; i++) {
if (modes[i].mode != mode ||
!modes[i].num_channels || !modes[i].channels)