2019-03-14 06:46:21

by Kangjie Lu

[permalink] [raw]
Subject: [PATCH] greybus: audio_manager: fix a missing check of ida_simple_get

ida_simple_get could fail. The fix inserts a check for its
return value.

Signed-off-by: Kangjie Lu <[email protected]>
---
drivers/staging/greybus/audio_manager.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/staging/greybus/audio_manager.c b/drivers/staging/greybus/audio_manager.c
index d44b070d8862..c2a4af4c1d06 100644
--- a/drivers/staging/greybus/audio_manager.c
+++ b/drivers/staging/greybus/audio_manager.c
@@ -45,6 +45,9 @@ int gb_audio_manager_add(struct gb_audio_manager_module_descriptor *desc)
int err;

id = ida_simple_get(&module_id, 0, 0, GFP_KERNEL);
+ if (id < 0)
+ return id;
+
err = gb_audio_manager_module_create(&module, manager_kset,
id, desc);
if (err) {
--
2.17.1



2019-03-14 09:11:21

by Viresh Kumar

[permalink] [raw]
Subject: Re: [greybus-dev] [PATCH] greybus: audio_manager: fix a missing check of ida_simple_get

On 14-03-19, 01:45, Kangjie Lu wrote:
> ida_simple_get could fail. The fix inserts a check for its
> return value.
>
> Signed-off-by: Kangjie Lu <[email protected]>
> ---
> drivers/staging/greybus/audio_manager.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/staging/greybus/audio_manager.c b/drivers/staging/greybus/audio_manager.c
> index d44b070d8862..c2a4af4c1d06 100644
> --- a/drivers/staging/greybus/audio_manager.c
> +++ b/drivers/staging/greybus/audio_manager.c
> @@ -45,6 +45,9 @@ int gb_audio_manager_add(struct gb_audio_manager_module_descriptor *desc)
> int err;
>
> id = ida_simple_get(&module_id, 0, 0, GFP_KERNEL);
> + if (id < 0)
> + return id;
> +
> err = gb_audio_manager_module_create(&module, manager_kset,
> id, desc);
> if (err) {

Acked-by: Viresh Kumar <[email protected]>

--
viresh

2019-03-15 05:21:24

by Vaibhav Agarwal

[permalink] [raw]
Subject: Re: [PATCH] greybus: audio_manager: fix a missing check of ida_simple_get

On Thu, Mar 14, 2019 at 12:15 PM Kangjie Lu <[email protected]> wrote:
>
> ida_simple_get could fail. The fix inserts a check for its
> return value.
>
> Signed-off-by: Kangjie Lu <[email protected]>
> ---
> drivers/staging/greybus/audio_manager.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/staging/greybus/audio_manager.c b/drivers/staging/greybus/audio_manager.c
> index d44b070d8862..c2a4af4c1d06 100644
> --- a/drivers/staging/greybus/audio_manager.c
> +++ b/drivers/staging/greybus/audio_manager.c
> @@ -45,6 +45,9 @@ int gb_audio_manager_add(struct gb_audio_manager_module_descriptor *desc)
> int err;
>
> id = ida_simple_get(&module_id, 0, 0, GFP_KERNEL);
> + if (id < 0)
> + return id;
> +
> err = gb_audio_manager_module_create(&module, manager_kset,
> id, desc);
> if (err) {

Reviewed-by: Vaibhav Agarwal <[email protected]>

--
./va

2019-04-30 15:30:51

by Mark Greer

[permalink] [raw]
Subject: Re: [PATCH] greybus: audio_manager: fix a missing check of ida_simple_get

On Fri, Mar 15, 2019 at 10:49:46AM +0530, Vaibhav Agarwal wrote:
> On Thu, Mar 14, 2019 at 12:15 PM Kangjie Lu <[email protected]> wrote:
> >
> > ida_simple_get could fail. The fix inserts a check for its
> > return value.
> >
> > Signed-off-by: Kangjie Lu <[email protected]>
> > ---
> > drivers/staging/greybus/audio_manager.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/staging/greybus/audio_manager.c b/drivers/staging/greybus/audio_manager.c
> > index d44b070d8862..c2a4af4c1d06 100644
> > --- a/drivers/staging/greybus/audio_manager.c
> > +++ b/drivers/staging/greybus/audio_manager.c
> > @@ -45,6 +45,9 @@ int gb_audio_manager_add(struct gb_audio_manager_module_descriptor *desc)
> > int err;
> >
> > id = ida_simple_get(&module_id, 0, 0, GFP_KERNEL);
> > + if (id < 0)
> > + return id;
> > +
> > err = gb_audio_manager_module_create(&module, manager_kset,
> > id, desc);
> > if (err) {
>
> Reviewed-by: Vaibhav Agarwal <[email protected]>

I am sorry for not responding until now. For some strange reason, email
from this list are being delayed. I just got this today (April 30).

Thanks for the patch, Kangjie, and thanks for the review, Vaibhav.

And FWIW,

Reviewed-by: Mark Greer <[email protected]>

Mark
--