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]
Date:   Fri, 19 Oct 2018 21:47:57 +0200
From:   Alexandre Belloni <alexandre.belloni@...tlin.com>
To:     Nathan Chancellor <natechancellor@...il.com>
Cc:     Alessandro Zummo <a.zummo@...ertech.it>, linux-rtc@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rtc: s35390a: Make buf an unsigned char in s35390a_init

Hello,

On 18/10/2018 14:42:07-0700, Nathan Chancellor wrote:
> Clang warns:
> 
> drivers/rtc/rtc-s35390a.c:124:27: warning: implicit conversion from
> 'int' to 'char' changes value from 192 to -64 [-Wconstant-conversion]
>         buf = S35390A_FLAG_RESET | S35390A_FLAG_24H;
>             ~ ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
> 1 warning generated.
> 
> Update buf to be an unsigned char, which matches the size and signedness
> of the buf member in struct i2c_msg (__u8).
> 
> https://github.com/ClangBuiltLinux/linux/issues/145
> Signed-off-by: Nathan Chancellor <natechancellor@...il.com>
> ---
>  drivers/rtc/rtc-s35390a.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
> index 77feb603cd4c..9fd51337cfae 100644
> --- a/drivers/rtc/rtc-s35390a.c
> +++ b/drivers/rtc/rtc-s35390a.c
> @@ -108,7 +108,7 @@ static int s35390a_get_reg(struct s35390a *s35390a, int reg, char *buf, int len)
>  
>  static int s35390a_init(struct s35390a *s35390a)
>  {
> -	char buf;
> +	unsigned char buf;

I would use a u8 directly which has the advantage to be shorter :)

>  	int ret;
>  	unsigned initcount = 0;
>  
> -- 
> 2.19.1
> 

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ