2011-02-23 13:25:45

by Manohar Vanga

[permalink] [raw]
Subject: [PATCH 0/2] staging: vme: fix issues in vme_register_bridge

This patchset fixes two issues I found in vme_register_bridge.
The first gets rid of some unreachable code and the second one fixes
a bug that could potentially lead to an infinite loop in the event
that device_register fails.

Please skip the previous patchset I sent and reacknowledge these.
Apologies for the noise pollution.

Thanks,
Manohar Vanga

Manohar Vanga (2):
staging: vme: remove unreachable code
staging: vme: fix loop condition

drivers/staging/vme/vme.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)


2011-02-23 13:25:48

by Manohar Vanga

[permalink] [raw]
Subject: [PATCH 1/2] staging: vme: remove unreachable code

Removed some unreachable code from vme_register_bridge

Signed-off-by: Manohar Vanga <[email protected]>
---
drivers/staging/vme/vme.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/vme/vme.c b/drivers/staging/vme/vme.c
index d9fc864..88bf455 100644
--- a/drivers/staging/vme/vme.c
+++ b/drivers/staging/vme/vme.c
@@ -1363,7 +1363,6 @@ int vme_register_bridge(struct vme_bridge *bridge)

return retval;

- i = VME_SLOTS_MAX;
err_reg:
while (i > -1) {
dev = &bridge->dev[i];
--
1.7.1

2011-02-23 13:25:59

by Manohar Vanga

[permalink] [raw]
Subject: [PATCH 2/2] staging: vme: fix loop condition

Fix loop condition in vme_register_bridge that results in an infinite
loop in the event that device_register fails.

Signed-off-by: Manohar Vanga <[email protected]>
---
drivers/staging/vme/vme.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/vme/vme.c b/drivers/staging/vme/vme.c
index 88bf455..c1ec230 100644
--- a/drivers/staging/vme/vme.c
+++ b/drivers/staging/vme/vme.c
@@ -1364,7 +1364,7 @@ int vme_register_bridge(struct vme_bridge *bridge)
return retval;

err_reg:
- while (i > -1) {
+ while (--i >= 0) {
dev = &bridge->dev[i];
device_unregister(dev);
}
--
1.7.1

2011-02-23 13:57:08

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH 1/2] staging: vme: remove unreachable code

On Wed, Feb 23, 2011 at 02:25:27PM +0100, Manohar Vanga wrote:
> Removed some unreachable code from vme_register_bridge
>
> Signed-off-by: Manohar Vanga <[email protected]>

Acked-by: Dan Carpenter <[email protected]>

2011-02-23 13:58:16

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH 2/2] staging: vme: fix loop condition

On Wed, Feb 23, 2011 at 02:25:28PM +0100, Manohar Vanga wrote:
> Fix loop condition in vme_register_bridge that results in an infinite
> loop in the event that device_register fails.
>

Acked-by: Dan Carpenter <[email protected]>

2011-02-23 17:00:37

by Martyn Welch

[permalink] [raw]
Subject: Re: [PATCH 1/2] staging: vme: remove unreachable code

On 23/02/11 13:25, Manohar Vanga wrote:
> Removed some unreachable code from vme_register_bridge
>
> Signed-off-by: Manohar Vanga <[email protected]>

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

> ---
> drivers/staging/vme/vme.c | 1 -
> 1 files changed, 0 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/staging/vme/vme.c b/drivers/staging/vme/vme.c
> index d9fc864..88bf455 100644
> --- a/drivers/staging/vme/vme.c
> +++ b/drivers/staging/vme/vme.c
> @@ -1363,7 +1363,6 @@ int vme_register_bridge(struct vme_bridge *bridge)
>
> return retval;
>
> - i = VME_SLOTS_MAX;
> err_reg:
> while (i > -1) {
> dev = &bridge->dev[i];


--
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 17:01:22

by Martyn Welch

[permalink] [raw]
Subject: Re: [PATCH 2/2] staging: vme: fix loop condition

On 23/02/11 13:25, Manohar Vanga wrote:
> Fix loop condition in vme_register_bridge that results in an infinite
> loop in the event that device_register fails.
>
> Signed-off-by: Manohar Vanga <[email protected]>

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

> ---
> drivers/staging/vme/vme.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/staging/vme/vme.c b/drivers/staging/vme/vme.c
> index 88bf455..c1ec230 100644
> --- a/drivers/staging/vme/vme.c
> +++ b/drivers/staging/vme/vme.c
> @@ -1364,7 +1364,7 @@ int vme_register_bridge(struct vme_bridge *bridge)
> return retval;
>
> err_reg:
> - while (i > -1) {
> + while (--i >= 0) {
> dev = &bridge->dev[i];
> device_unregister(dev);
> }


--
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