Skip to content

Commit ff9a71a

Browse files
committed
nl80211: explicitly check enum nl80211_mesh_power_mode
Different gcc versions appear to be treating enum with different signedness, causing warnings with the out parameter one way or the other. Just use the correct type to avoid all that. Signed-off-by: Johannes Berg <[email protected]>
1 parent 4fdbc67 commit ff9a71a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

net/wireless/nl80211.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5353,6 +5353,18 @@ static int nl80211_check_s32(const struct nlattr *nla, s32 min, s32 max, s32 *ou
53535353
return 0;
53545354
}
53555355

5356+
static int nl80211_check_power_mode(const struct nlattr *nla,
5357+
enum nl80211_mesh_power_mode min,
5358+
enum nl80211_mesh_power_mode max,
5359+
enum nl80211_mesh_power_mode *out)
5360+
{
5361+
u32 val = nla_get_u32(nla);
5362+
if (val < min || val > max)
5363+
return -EINVAL;
5364+
*out = val;
5365+
return 0;
5366+
}
5367+
53565368
static int nl80211_parse_mesh_config(struct genl_info *info,
53575369
struct mesh_config *cfg,
53585370
u32 *mask_out)
@@ -5497,7 +5509,7 @@ do { \
54975509
NL80211_MESH_POWER_ACTIVE,
54985510
NL80211_MESH_POWER_MAX,
54995511
mask, NL80211_MESHCONF_POWER_MODE,
5500-
nl80211_check_u32);
5512+
nl80211_check_power_mode);
55015513
FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshAwakeWindowDuration,
55025514
0, 65535, mask,
55035515
NL80211_MESHCONF_AWAKE_WINDOW, nl80211_check_u16);

0 commit comments

Comments
 (0)