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] [day] [month] [year] [list]
Message-ID: <5124E520.709@suse.cz>
Date:	Wed, 20 Feb 2013 16:00:48 +0100
From:	Jiri Slaby <jslaby@...e.cz>
To:	Pawel Wieczorkiewicz <wpawel@...il.com>, nicolas.ferre@...el.com,
	gregkh@...uxfoundation.org, grant.likely@...retlab.ca
CC:	linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] tty: atmel_serial_probe(): index of atmel_ports[]
 fix

On 02/13/2013 12:17 AM, Pawel Wieczorkiewicz wrote:
> From: Pawel Wieczorkiewicz <wpawel@...il.com>
> 
> Index of atmel_ports[ATMEL_MAX_UART] should be smaller
> than ATMEL_MAX_UART.
> 
> Signed-off-by: Pawel Wieczorkiewicz <wpawel@...il.com>
> ---
>  drivers/tty/serial/atmel_serial.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index d4a7c24..3f7586a 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -1772,7 +1772,7 @@ static int atmel_serial_probe(struct platform_device *pdev)
>  		ret = find_first_zero_bit(&atmel_ports_in_use,
>  				sizeof(atmel_ports_in_use));
>  
> -	if (ret > ATMEL_MAX_UART) {
> +	if (!(ret < ATMEL_MAX_UART)) {

Good catch, but the result looks weird. Could you just make it ">="?

And find_first_zero_bit + sizeof above is bogus too. The sizeof returns
4 on 32-bit (the driver is run on 32bit machines exlusively AFAICS). So
the highest possible ret in there is 5. Instead atmel_ports_in_use
should be declared using DECLARE_BITMAP(atmel_ports_in_use,
ATMEL_MAX_UART) and the second parameter here then ATMEL_MAX_UART.

Could you fix that too?

-- 
js
suse labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ