* [PATCH] rtl8712: rtl871x_ioctl_linux.c: fix unnecessary typecast @ 2019-08-06 1:33 Jose Carlos Cazarin Filho 2019-08-06 11:53 ` Dan Carpenter 0 siblings, 1 reply; 4+ messages in thread From: Jose Carlos Cazarin Filho @ 2019-08-06 1:33 UTC (permalink / raw) To: Larry.Finger, florian.c.schilhabel, gregkh, devel, linux-kernel, lkcamp Fix checkpath warning: WARNING: Unnecessary typecast of c90 int constant Signed-off-by: Jose Carlos Cazarin Filho <joseespiriki@gmail.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)) { int f = fwrq->m / 100000; int c = 0; -- 2.17.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] rtl8712: rtl871x_ioctl_linux.c: fix unnecessary typecast 2019-08-06 1:33 [PATCH] rtl8712: rtl871x_ioctl_linux.c: fix unnecessary typecast Jose Carlos Cazarin Filho @ 2019-08-06 11:53 ` Dan Carpenter 2019-08-06 13:10 ` David Laight 0 siblings, 1 reply; 4+ messages in thread From: Dan Carpenter @ 2019-08-06 11:53 UTC (permalink / raw) To: Jose Carlos Cazarin Filho Cc: Larry.Finger, florian.c.schilhabel, gregkh, devel, linux-kernel, lkcamp 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@gmail.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. regards, dan carpenter ^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] rtl8712: rtl871x_ioctl_linux.c: fix unnecessary typecast 2019-08-06 11:53 ` Dan Carpenter @ 2019-08-06 13:10 ` David Laight 2019-08-07 2:00 ` José Carlos Cazarin Filho 0 siblings, 1 reply; 4+ messages in thread From: David Laight @ 2019-08-06 13:10 UTC (permalink / raw) To: 'Dan Carpenter', Jose Carlos Cazarin Filho Cc: Larry.Finger@lwfinger.net, florian.c.schilhabel@googlemail.com, gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, lkcamp@lists.libreplanetbr.org 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@gmail.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) ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rtl8712: rtl871x_ioctl_linux.c: fix unnecessary typecast 2019-08-06 13:10 ` David Laight @ 2019-08-07 2:00 ` José Carlos Cazarin Filho 0 siblings, 0 replies; 4+ messages in thread From: José Carlos Cazarin Filho @ 2019-08-07 2:00 UTC (permalink / raw) To: David Laight Cc: Dan Carpenter, Larry.Finger@lwfinger.net, florian.c.schilhabel@googlemail.com, gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, lkcamp@lists.libreplanetbr.org Sorry folks, I haven't properly tested this before sending the patch After I've removed the cast, I got this error: drivers/staging/rtl8712/rtl871x_ioctl_linux.c:668:13: error: SSE register return with SSE disabled (fwrq->m >= 2.412e8) && ~~~~~~~~~^~~~~~~~~~~ But I think it's strange since you said that this compiled fine in your environments. I think we need to take a deeper look into this. Kind regards Em ter, 6 de ago de 2019 às 10:10, David Laight <David.Laight@aculab.com> escreveu: > > 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@gmail.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) > ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-08-07 2:01 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-08-06 1:33 [PATCH] rtl8712: rtl871x_ioctl_linux.c: fix unnecessary typecast Jose Carlos Cazarin Filho 2019-08-06 11:53 ` Dan Carpenter 2019-08-06 13:10 ` David Laight 2019-08-07 2:00 ` José Carlos Cazarin Filho
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox