public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: simran singhal <singhalsimran0@gmail.com>, gregkh@linuxfoundation.org
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 5/9] staging: rtl8192u: Use min_t instead of min
Date: Tue, 14 Feb 2017 12:32:04 -0800	[thread overview]
Message-ID: <1487104324.6214.29.camel@perches.com> (raw)
In-Reply-To: <20170214201333.GA2764@singhal-Inspiron-5558>

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.

      reply	other threads:[~2017-02-14 20:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1487104324.6214.29.camel@perches.com \
    --to=joe@perches.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=singhalsimran0@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox