3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 09:39:25 +01:00

eap: Silence uninitialized var warning

src/eap.c: In function 'eap_rx_packet':
src/eap.c:419:50: error: 'vendor_type' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  419 |  (type == EAP_TYPE_EXPANDED && vendor_id == (id) && vendor_type == (t))
      |                                                  ^~
src/eap.c:430:11: note: 'vendor_type' was declared here
  430 |  uint32_t vendor_type;

It isn't clear why GCC complains about vendor_type, but not vendor_id.
But in all cases if type == EAP_TYPE_EXPANDED, then vendor_type and
vendor_id are set.  Silence this spurious warning.
This commit is contained in:
Denis Kenzior 2021-11-08 15:11:55 -06:00
parent 43059d5022
commit cfd191a803

View File

@ -413,8 +413,11 @@ static const char *eap_type_to_str(enum eap_type type, uint32_t vendor_id,
return buf;
}
_Pragma("GCC diagnostic push")
_Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
#define IS_EXPANDED_RESPONSE(id, t) \
(type == EAP_TYPE_EXPANDED && vendor_id == (id) && vendor_type == (t))
_Pragma("GCC diagnostic pop")
#define RESPONSE_IS(t) \
(type == (t) || IS_EXPANDED_RESPONSE(0, (t)))