[PATCH] Fix wpa_cipher_to_alg return type

Joel Cunningham joel.cunningham at me.com
Mon Dec 19 14:46:42 PST 2016


From dccd84c092d0fbaaaea1d7081a270cfdc84e570e Mon Sep 17 00:00:00 2001
From: Joel Cunningham <joel.cunningham at me.com>
Date: Mon, 19 Dec 2016 16:34:24 -0600
Subject: [PATCH] Fix wpa_cipher_to_alg return type

wpa_cipher_to_alg returns enumerated values from enum wpa_alg and all
uses of the return value treat it as enum wpa_alg (by either assigning
it to a variable of type enum wpa_alg or passing to a function that
expects enum wpa_alg)

This commit updates the return value to match the expected usage
(enum wpa_alg) rather than int. This ensures the return value is
of the proper type and elimantes the following compiler warnings:

ARM RVCT (2.2):
  'Warning: #188-D: enumerated type mixed with another type'

Signed-off-by: Joel Cunningham <joel.cunningham at me.com>
---
 src/common/wpa_common.c | 2 +-
 src/common/wpa_common.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/common/wpa_common.c b/src/common/wpa_common.c
index a87210e..ea1f4ed 100644
--- a/src/common/wpa_common.c
+++ b/src/common/wpa_common.c
@@ -1621,7 +1621,7 @@ int wpa_cipher_rsc_len(int cipher)
 }
 
 
-int wpa_cipher_to_alg(int cipher)
+enum wpa_alg wpa_cipher_to_alg(int cipher)
 {
 	switch (cipher) {
 	case WPA_CIPHER_CCMP_256:
diff --git a/src/common/wpa_common.h b/src/common/wpa_common.h
index 6d28417..b48c24e 100644
--- a/src/common/wpa_common.h
+++ b/src/common/wpa_common.h
@@ -437,7 +437,7 @@ int wpa_ft_parse_ies(const u8 *ies, size_t ies_len, struct wpa_ft_ies *parse);
 
 int wpa_cipher_key_len(int cipher);
 int wpa_cipher_rsc_len(int cipher);
-int wpa_cipher_to_alg(int cipher);
+enum wpa_alg wpa_cipher_to_alg(int cipher);
 int wpa_cipher_valid_group(int cipher);
 int wpa_cipher_valid_pairwise(int cipher);
 int wpa_cipher_valid_mgmt_group(int cipher);
-- 
2.10.0


More information about the Hostap mailing list