linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 5/9] staging: rtl8192u: Use min_t instead of min
@ 2017-02-14 20:13 simran singhal
  2017-02-14 20:32 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: simran singhal @ 2017-02-14 20:13 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel

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)

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
---
 drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c
index 2481c21..fff2020 100644
--- 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);
 		start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid);
 	}
 	/* Add the protocol name */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 5/9] staging: rtl8192u: Use min_t instead of min
  2017-02-14 20:13 [PATCH v2 5/9] staging: rtl8192u: Use min_t instead of min simran singhal
@ 2017-02-14 20:32 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2017-02-14 20:32 UTC (permalink / raw)
  To: simran singhal, gregkh; +Cc: devel, linux-kernel

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-14 20:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-14 20:13 [PATCH v2 5/9] staging: rtl8192u: Use min_t instead of min simran singhal
2017-02-14 20:32 ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).