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: <4971bda5-e337-4c40-b7bd-5da4b7dae5d7@kernel.org>
Date: Fri, 16 Feb 2024 06:51:01 +0100
From: Jiri Slaby <jirislaby@...nel.org>
To: Serge Semin <fancer.lancer@...il.com>,
 Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
 Arnd Bergmann <arnd@...db.de>, Jiaxun Yang <jiaxun.yang@...goat.com>
Cc: Alexey Malahov <Alexey.Malahov@...kalelectronics.ru>,
 Stephen Rothwell <sfr@...hwell.id.au>,
 Andrew Morton <akpm@...ux-foundation.org>, linux-mips@...r.kernel.org,
 linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/4] tty: mips_ejtag_fdc: Fix passing incompatible pointer
 type warning

On 15. 02. 24, 18:17, Serge Semin wrote:
> mips_ejtag_fdc_encode() method expects having a first argument passed of
> the "u8 **" type, meanwhile the driver passes the "const char **" type.
> That causes the next build-warning:
> 
> drivers/tty/mips_ejtag_fdc.c: In function ‘mips_ejtag_fdc_console_write’:
> drivers/tty/mips_ejtag_fdc.c:343:32: error: passing argument 1 of ‘mips_ejtag_fdc_encode’ from incompatible pointer type [-Werror=incompatible-pointer-types]
>     word = mips_ejtag_fdc_encode(&buf_ptr, &buf_len, 1);
>                                  ^
> drivers/tty/mips_ejtag_fdc.c:216:24: note: expected ‘const u8 ** {aka const unsigned char **}’ but argument is of type ‘const char **’
>   static struct fdc_word mips_ejtag_fdc_encode(const u8 **ptrs,
>                          ^~~~~~~~~~~~~~~~~~~~~

It's a correct change. But why the compiler complains, given
KBUILD_CFLAGS += -funsigned-char
?

> Fix it by altering the type of the pointer which is passed to the
> mips_ejtag_fdc_encode() method.
> 
> Fixes: ce7cbd9a6c81 ("tty: mips_ejtag_fdc: use u8 for character pointers")
> Signed-off-by: Serge Semin <fancer.lancer@...il.com>
> ---
>   drivers/tty/mips_ejtag_fdc.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/mips_ejtag_fdc.c b/drivers/tty/mips_ejtag_fdc.c
> index aac80b69a069..afbf7738c7c4 100644
> --- a/drivers/tty/mips_ejtag_fdc.c
> +++ b/drivers/tty/mips_ejtag_fdc.c
> @@ -309,7 +309,7 @@ static void mips_ejtag_fdc_console_write(struct console *c, const char *s,
>   	unsigned int i, buf_len, cpu;
>   	bool done_cr = false;
>   	char buf[4];
> -	const char *buf_ptr = buf;
> +	const u8 *buf_ptr = buf;
>   	/* Number of bytes of input data encoded up to each byte in buf */
>   	u8 inc[4];
>   

thanks,
-- 
js
suse labs


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ