From: Dan Carpenter <dan.carpenter@oracle.com>
To: Przemo Firszt <przemo@firszt.eu>
Cc: Larry.Finger@lwfinger.net, florian.c.schilhabel@googlemail.com,
greg@kroah.com, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/5] rtl8712: replace min with min_t
Date: Mon, 10 Dec 2012 12:41:08 +0300 [thread overview]
Message-ID: <20121210094108.GQ6568@mwanda> (raw)
In-Reply-To: <1355048110-10859-4-git-send-email-przemo@firszt.eu>
On Sun, Dec 09, 2012 at 10:15:09AM +0000, Przemo Firszt wrote:
> A clean up change suggested by checkpatch.pl
>
> Signed-off-by: Przemo Firszt <przemo@firszt.eu>
> ---
> drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> index cdb51d7..b131b61 100644
> --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> @@ -188,8 +188,7 @@ static inline char *translate_scan(struct _adapter *padapter,
> /* Add the ESSID */
> iwe.cmd = SIOCGIWESSID;
> iwe.u.data.flags = 1;
> - iwe.u.data.length = (u16)min((u16)pnetwork->network.Ssid.SsidLength,
> - (u16)32);
> + iwe.u.data.length = min_t(u16, pnetwork->network.Ssid.SsidLength, 32);
pnetwork->network.Ssid.SsidLength is a u32 so it would be better to
not truncate the upper bits away. It's not going to cause a
problem, but its slightly messy.
This is a common problem where people take the type of
iwe.u.data.length and cast to that instead of considering the types
for the data they are comparing.
regards,
dan carpenter
next prev parent reply other threads:[~2012-12-10 9:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-09 10:15 [PATCH 1/5] rtl8712: code clean up Przemo Firszt
2012-12-09 10:15 ` [PATCH 2/5] rtl8712: remove unused macros from rtl8712/wifi.h Przemo Firszt
2012-12-09 10:15 ` [PATCH 3/5] rtl8712: replace printk with better solutions Przemo Firszt
2012-12-09 11:47 ` Joe Perches
2012-12-09 10:15 ` [PATCH 4/5] rtl8712: replace min with min_t Przemo Firszt
2012-12-10 9:41 ` Dan Carpenter [this message]
2012-12-10 22:21 ` Przemo Firszt
2012-12-10 22:49 ` Dan Carpenter
2012-12-10 23:20 ` Przemo Firszt
2012-12-09 10:15 ` [PATCH 5/5] rtl8712: replace leading spaces with tab Przemo Firszt
2012-12-10 9:46 ` Dan Carpenter
2012-12-10 11:49 ` Joe Perches
2012-12-10 12:21 ` Dan Carpenter
2012-12-10 13:47 ` Joe Perches
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=20121210094108.GQ6568@mwanda \
--to=dan.carpenter@oracle.com \
--cc=Larry.Finger@lwfinger.net \
--cc=devel@driverdev.osuosl.org \
--cc=florian.c.schilhabel@googlemail.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=przemo@firszt.eu \
/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;
as well as URLs for NNTP newsgroup(s).