linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: Pawel Wieczorkiewicz <wpawel@gmail.com>,
	nicolas.ferre@atmel.com, gregkh@linuxfoundation.org,
	grant.likely@secretlab.ca
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] tty: atmel_serial_probe(): index of atmel_ports[] fix
Date: Wed, 20 Feb 2013 16:00:48 +0100	[thread overview]
Message-ID: <5124E520.709@suse.cz> (raw)
In-Reply-To: <1360711049-5557-1-git-send-email-wpawel@gmail.com>

On 02/13/2013 12:17 AM, Pawel Wieczorkiewicz wrote:
> From: Pawel Wieczorkiewicz <wpawel@gmail.com>
> 
> Index of atmel_ports[ATMEL_MAX_UART] should be smaller
> than ATMEL_MAX_UART.
> 
> Signed-off-by: Pawel Wieczorkiewicz <wpawel@gmail.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

  reply	other threads:[~2013-02-20 15:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-12 23:17 [PATCH 1/1] tty: atmel_serial_probe(): index of atmel_ports[] fix Pawel Wieczorkiewicz
2013-02-20 15:00 ` Jiri Slaby [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-02-20 16:26 Pawel Wieczorkiewicz
2013-03-15 14:36 ` Nicolas Ferre
2013-03-15 14:58   ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5124E520.709@suse.cz \
    --to=jslaby@suse.cz \
    --cc=grant.likely@secretlab.ca \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=nicolas.ferre@atmel.com \
    --cc=wpawel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).