2011-02-23 09:49:51

by Martyn Welch

[permalink] [raw]
Subject: Re: [PATCH 2/2] staging: vme: fix bug in vme_register_bridge

On 23/02/11 09:26, Manohar Vanga wrote:
> Fix a bug in vme_register_bridge that results in an infinite loop in
> the event that device_register fails.
>

Good catch!

Acked-by: Martyn Welch <[email protected]>

> Signed-off-by: Manohar Vanga <[email protected]>
> ---
> drivers/staging/vme/vme.c | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/staging/vme/vme.c b/drivers/staging/vme/vme.c
> index 88bf455..e77d6a8 100644
> --- a/drivers/staging/vme/vme.c
> +++ b/drivers/staging/vme/vme.c
> @@ -1364,9 +1364,14 @@ int vme_register_bridge(struct vme_bridge *bridge)
> return retval;
>
> err_reg:
> + /*
> + * Ignore the failed device and unregister the rest.
> + */
> + i--;
> while (i > -1) {
> dev = &bridge->dev[i];
> device_unregister(dev);
> + i--;
> }
> vme_free_bus_num(bridge->num);
> return retval;


--
Martyn Welch (Principal Software Engineer) | Registered in England and
GE Intelligent Platforms | Wales (3828642) at 100
T +44(0)127322748 | Barbirolli Square, Manchester,
E [email protected] | M2 3AB VAT:GB 927559189


2011-02-23 12:25:06

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH 2/2] staging: vme: fix bug in vme_register_bridge

On Wed, Feb 23, 2011 at 09:44:42AM +0000, Martyn Welch wrote:
> On 23/02/11 09:26, Manohar Vanga wrote:
> > Fix a bug in vme_register_bridge that results in an infinite loop in
> > the event that device_register fails.

[snip]

> > + /*
> > + * Ignore the failed device and unregister the rest.
> > + */
> > + i--;
> > while (i > -1) {
> > dev = &bridge->dev[i];
> > device_unregister(dev);
> > + i--;
> > }

Ah. I see you fixed the bug already. Good deal. Btw, no need to add
comments for the obvious stuff.

You still aren't CCing the right list, [email protected].
It's not enough for Martyn to sent it to us, because by that point
the patch has '> ' chars on every line.

regards,
dan carpenter