lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.22.394.2210280918550.2845@hadrien>
Date:   Fri, 28 Oct 2022 09:22:33 +0200 (CEST)
From:   Julia Lawall <julia.lawall@...ia.fr>
To:     UMWARI JOVIAL <umwarijovial@...il.com>
cc:     gregkh@...uxfoundation.org, linux-staging@...ts.linux.dev,
        linux-kernel@...r.kernel.org, outreachy@...ts.linux.dev
Subject: Re: [PATCH] Remove Unnecessary typecast of c90 int constant



On Fri, 28 Oct 2022, UMWARI JOVIAL wrote:

> According to Linux kernel coding style.
>
> Reported by checkpatch:
> WARNING: Unnecessary typecast of c90 int constant - '(int)2.412e8' could be '2.412e8'
> WARNING: Unnecessary typecast of c90 int constant - '(int)2.487e8' could be '2.487e8'

It's not ideal to just include the checkpatch messges verbatim in your log
message.  It woudl be better to say what you are doing and why, in
complete sentences ("According to the Linux coding style" is not a
complete sentence).

I also suspect that the checkpatch message is wrong.  Floating point
numbers cannot be used in the kernel, and the case of the constant ensures
that the value will be converted to an integer at compile time.

julia

>
> Signed-off-by: UMWARI JOVIAL <umwarijovial@...il.com>
> ---
>  drivers/staging/rtl8192e/rtllib_softmac_wx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/rtl8192e/rtllib_softmac_wx.c b/drivers/staging/rtl8192e/rtllib_softmac_wx.c
> index fdf867a5dd7a..4fc4fb25d8d6 100644
> --- a/drivers/staging/rtl8192e/rtllib_softmac_wx.c
> +++ b/drivers/staging/rtl8192e/rtllib_softmac_wx.c
> @@ -41,8 +41,8 @@ int rtllib_wx_set_freq(struct rtllib_device *ieee, struct iw_request_info *a,
>
>  	/* if setting by freq convert to channel */
>  	if (fwrq->e == 1) {
> -		if ((fwrq->m >= (int)2.412e8 &&
> -		     fwrq->m <= (int)2.487e8)) {
> +		if ((fwrq->m >= 2.412e8 &&
> +		     fwrq->m <= 2.487e8)) {
>  			int f = fwrq->m / 100000;
>  			int c = 0;
>
> --
> 2.25.1
>
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ