[PATCH v2 5/9] staging: rtl8192u: Use min_t instead of min

Joe Perches joe at perches.com
Tue Feb 14 20:32:04 UTC 2017


On Wed, 2017-02-15 at 01:43 +0530, simran singhal wrote:
> Use min_t instead of min function in ieee80211/ieee80211_wx.c
> fixed warning:
> WARNING: min() should probably be min_t(u8, network->ssid_len, 32)
[]
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c
[]
> @@ -80,7 +80,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
>  		iwe.u.data.length = sizeof("<hidden>");
>  		start = iwe_stream_add_point(info, start, stop, &iwe, "<hidden>");
>  	} else {
> -		iwe.u.data.length = min(network->ssid_len, (u8)32);
> +		iwe.u.data.length = min_t(u8, network->ssid_len, 32);

Umm, no.  A checkpatch message that says
"probably", is not a reason to do what it says.

It's _maybe_ something that could be investigated.

ssid_len is size_t and u.data.length is u16.
Why should it be truncated to a u8?

It'd be getter to remove the u8 cast altogether.



More information about the devel mailing list