All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: Alexey Khoroshilov <khoroshilov@ispras.ru>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org
Subject: Re: [PATCH] tty: mxser: fix cycle termination condition in mxser_probe() and mxser_module_init()
Date: Mon, 08 Apr 2013 09:18:38 +0200	[thread overview]
Message-ID: <51626F4E.1000005@suse.cz> (raw)
In-Reply-To: <1365364007-6298-1-git-send-email-khoroshilov@ispras.ru>

On 04/07/2013 09:46 PM, Alexey Khoroshilov wrote:
> There is a bug in resources deallocation code in mxser_probe() and mxser_module_init().
> As soon as variable 'i' is unsigned int, cycle termination condition i >= 0 is always true.
> The patch fixes the issue.
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>

Yes, thanks.

Acked-by: Jiri Slaby <jslaby@suse.cz>

> ---
>  drivers/tty/mxser.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
> index 484b6a3..302909c 100644
> --- a/drivers/tty/mxser.c
> +++ b/drivers/tty/mxser.c
> @@ -2643,9 +2643,9 @@ static int mxser_probe(struct pci_dev *pdev,
>  				mxvar_sdriver, brd->idx + i, &pdev->dev);
>  		if (IS_ERR(tty_dev)) {
>  			retval = PTR_ERR(tty_dev);
> -			for (i--; i >= 0; i--)
> +			for (; i > 0; i--)
>  				tty_unregister_device(mxvar_sdriver,
> -					brd->idx + i);
> +					brd->idx + i - 1);
>  			goto err_relbrd;
>  		}
>  	}
> @@ -2751,9 +2751,9 @@ static int __init mxser_module_init(void)
>  			tty_dev = tty_port_register_device(&brd->ports[i].port,
>  					mxvar_sdriver, brd->idx + i, NULL);
>  			if (IS_ERR(tty_dev)) {
> -				for (i--; i >= 0; i--)
> +				for (; i > 0; i--)
>  					tty_unregister_device(mxvar_sdriver,
> -						brd->idx + i);
> +						brd->idx + i - 1);
>  				for (i = 0; i < brd->info->nports; i++)
>  					tty_port_destroy(&brd->ports[i].port);
>  				free_irq(brd->irq, brd);
> 


-- 
js
suse labs

      reply	other threads:[~2013-04-08  7:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <51228a02.BjrxclRZRRerxqem%fengguang.wu@intel.com>
2013-02-19  5:57 ` [PATCH v2] tty: mxser: improve error handling in mxser_probe() and mxser_module_init() Alexey Khoroshilov
2013-02-19 13:02   ` Jiri Slaby
2013-03-28 15:16   ` Jiri Slaby
2013-04-07 19:46     ` [PATCH] tty: mxser: fix cycle termination condition " Alexey Khoroshilov
2013-04-08  7:18       ` Jiri Slaby [this message]

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=51626F4E.1000005@suse.cz \
    --to=jslaby@suse.cz \
    --cc=gregkh@linuxfoundation.org \
    --cc=khoroshilov@ispras.ru \
    --cc=ldv-project@linuxtesting.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.