[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8d6c6714f9ca46ab90b2a747c05b899b@AcuMS.aculab.com>
Date: Tue, 6 Aug 2019 13:10:14 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Dan Carpenter' <dan.carpenter@...cle.com>,
Jose Carlos Cazarin Filho <joseespiriki@...il.com>
CC: "Larry.Finger@...inger.net" <Larry.Finger@...inger.net>,
"florian.c.schilhabel@...glemail.com"
<florian.c.schilhabel@...glemail.com>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"lkcamp@...ts.libreplanetbr.org" <lkcamp@...ts.libreplanetbr.org>
Subject: RE: [PATCH] rtl8712: rtl871x_ioctl_linux.c: fix unnecessary typecast
From: Dan Carpenter
> Sent: 06 August 2019 12:53
> On Mon, Aug 05, 2019 at 10:33:29PM -0300, Jose Carlos Cazarin Filho wrote:
> > Fix checkpath warning:
> > WARNING: Unnecessary typecast of c90 int constant
> >
> > Signed-off-by: Jose Carlos Cazarin Filho <joseespiriki@...il.com>
> > ---
> > Hello all!
> > This is my first commit to the Linux Kernel, I'm doing this to learn and be able
> > to contribute more in the future
> > Peace all!
> > drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> > index 944336e0d..da371072e 100644
> > --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> > +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> > @@ -665,8 +665,8 @@ static int r8711_wx_set_freq(struct net_device *dev,
> >
> > /* If setting by frequency, convert to a channel */
> > if ((fwrq->e == 1) &&
> > - (fwrq->m >= (int) 2.412e8) &&
> > - (fwrq->m <= (int) 2.487e8)) {
> > + (fwrq->m >= 2.412e8) &&
> > + (fwrq->m <= 2.487e8)) {
>
> I don't think we can do this. You're not allowed to use floats in the
> kernel (because they make context switching slow). I could have sworn
> that we use the -nofp to stop the compile when people use floats but
> this compiles fine for me.
My guess is the 'c90 int constant' text.
It rather implies that '2.412e8' has become the same as '2141200000'.
Which is rather worrying because suddenly 'int_var * 2.4e8' might
be an integer multiply rather than a double one and overflow.
Have the standard people broken code again?
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists