Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1584107 > unrolled thread
| Started by | Christophe JAILLET <christophe.jaillet@wanadoo.fr> |
|---|---|
| First post | 2017-02-19 11:40 +0100 |
| Last post | 2017-02-25 05:20 +0100 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] staging: bcm2835: Fix a memory leak in error handling path Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-02-19 11:40 +0100
Re: [PATCH] staging: bcm2835: Fix a memory leak in error handling path Stefan Wahren <stefan.wahren@i2se.com> - 2017-02-24 13:40 +0100
Re: [PATCH] staging: bcm2835: Fix a memory leak in error handling path Dan Carpenter <dan.carpenter@oracle.com> - 2017-02-24 21:00 +0100
Re: [PATCH] staging: bcm2835: Fix a memory leak in error handling path Stefan Wahren <stefan.wahren@i2se.com> - 2017-02-24 22:50 +0100
Re: [PATCH] staging: bcm2835: Fix a memory leak in error handling path Dan Carpenter <dan.carpenter@oracle.com> - 2017-02-25 05:20 +0100
| From | Christophe JAILLET <christophe.jaillet@wanadoo.fr> |
|---|---|
| Date | 2017-02-19 11:40 +0100 |
| Subject | [PATCH] staging: bcm2835: Fix a memory leak in error handling path |
| Message-ID | <tcx4m-6fm-5@gated-at.bofh.it> |
If 'kzalloc()' fails, we should release resources allocated so far, just as
done in all other cases in this function.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Not sure that the error handling path is correct.
Is 'gdev[0]' freed? Should it be?
---
drivers/staging/media/platform/bcm2835/bcm2835-camera.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/media/platform/bcm2835/bcm2835-camera.c b/drivers/staging/media/platform/bcm2835/bcm2835-camera.c
index ca15a698e018..9651b9bc3439 100644
--- a/drivers/staging/media/platform/bcm2835/bcm2835-camera.c
+++ b/drivers/staging/media/platform/bcm2835/bcm2835-camera.c
@@ -1914,8 +1914,10 @@ static int __init bm2835_mmal_init(void)
for (camera = 0; camera < num_cameras; camera++) {
dev = kzalloc(sizeof(struct bm2835_mmal_dev), GFP_KERNEL);
- if (!dev)
- return -ENOMEM;
+ if (!dev) {
+ ret = -ENOMEM;
+ goto free_dev;
+ }
dev->camera_num = camera;
dev->max_width = resolutions[camera][0];
--
2.9.3
[toc] | [next] | [standalone]
| From | Stefan Wahren <stefan.wahren@i2se.com> |
|---|---|
| Date | 2017-02-24 13:40 +0100 |
| Subject | Re: [PATCH] staging: bcm2835: Fix a memory leak in error handling path |
| Message-ID | <tenkd-7b-1@gated-at.bofh.it> |
| In reply to | #1584107 |
Hi Christophe,
Am 19.02.2017 um 11:34 schrieb Christophe JAILLET:
> If 'kzalloc()' fails, we should release resources allocated so far, just as
> done in all other cases in this function.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Not sure that the error handling path is correct.
> Is 'gdev[0]' freed? Should it be?
sorry, didn't checked your patch yet. Currently there are 3 bcm2835
drivers in staging (vchiq, camera, audio). So please resend with a more
distinct subject.
Thanks
Stefan
> ---
> drivers/staging/media/platform/bcm2835/bcm2835-camera.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/media/platform/bcm2835/bcm2835-camera.c b/drivers/staging/media/platform/bcm2835/bcm2835-camera.c
> index ca15a698e018..9651b9bc3439 100644
> --- a/drivers/staging/media/platform/bcm2835/bcm2835-camera.c
> +++ b/drivers/staging/media/platform/bcm2835/bcm2835-camera.c
> @@ -1914,8 +1914,10 @@ static int __init bm2835_mmal_init(void)
>
> for (camera = 0; camera < num_cameras; camera++) {
> dev = kzalloc(sizeof(struct bm2835_mmal_dev), GFP_KERNEL);
> - if (!dev)
> - return -ENOMEM;
> + if (!dev) {
> + ret = -ENOMEM;
> + goto free_dev;
> + }
>
> dev->camera_num = camera;
> dev->max_width = resolutions[camera][0];
[toc] | [prev] | [next] | [standalone]
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Date | 2017-02-24 21:00 +0100 |
| Subject | Re: [PATCH] staging: bcm2835: Fix a memory leak in error handling path |
| Message-ID | <teuc2-4Ze-19@gated-at.bofh.it> |
| In reply to | #1587562 |
On Fri, Feb 24, 2017 at 01:37:30PM +0100, Stefan Wahren wrote: > Hi Christophe, > > Am 19.02.2017 um 11:34 schrieb Christophe JAILLET: > >If 'kzalloc()' fails, we should release resources allocated so far, just as > >done in all other cases in this function. > > > >Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> > >--- > >Not sure that the error handling path is correct. > >Is 'gdev[0]' freed? Should it be? > Yes, but I already sent a patch to fix this and your leak as well and Greg merged it. > sorry, didn't checked your patch yet. It takes like 30 seconds to review this patch. Do you use mutt? I have a macro that applies patches and loads vim at the right line. regards, dan carpenter
[toc] | [prev] | [next] | [standalone]
| From | Stefan Wahren <stefan.wahren@i2se.com> |
|---|---|
| Date | 2017-02-24 22:50 +0100 |
| Subject | Re: [PATCH] staging: bcm2835: Fix a memory leak in error handling path |
| Message-ID | <tevUu-6cZ-33@gated-at.bofh.it> |
| In reply to | #1587905 |
> Dan Carpenter <dan.carpenter@oracle.com> hat am 24. Februar 2017 um 20:57 geschrieben: > > > On Fri, Feb 24, 2017 at 01:37:30PM +0100, Stefan Wahren wrote: > > Hi Christophe, > > > > Am 19.02.2017 um 11:34 schrieb Christophe JAILLET: > > >If 'kzalloc()' fails, we should release resources allocated so far, just as > > >done in all other cases in this function. > > > > > >Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> > > >--- > > >Not sure that the error handling path is correct. > > >Is 'gdev[0]' freed? Should it be? > > > > Yes, but I already sent a patch to fix this and your leak as well and > Greg merged it. My leak? I'm confused.
[toc] | [prev] | [next] | [standalone]
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Date | 2017-02-25 05:20 +0100 |
| Subject | Re: [PATCH] staging: bcm2835: Fix a memory leak in error handling path |
| Message-ID | <teBZT-2jg-1@gated-at.bofh.it> |
| In reply to | #1587963 |
On Fri, Feb 24, 2017 at 10:38:38PM +0100, Stefan Wahren wrote: > > > Dan Carpenter <dan.carpenter@oracle.com> hat am 24. Februar 2017 um 20:57 geschrieben: > > > > > > On Fri, Feb 24, 2017 at 01:37:30PM +0100, Stefan Wahren wrote: > > > Hi Christophe, > > > > > > Am 19.02.2017 um 11:34 schrieb Christophe JAILLET: > > > >If 'kzalloc()' fails, we should release resources allocated so far, just as > > > >done in all other cases in this function. > > > > > > > >Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> > > > >--- > > > >Not sure that the error handling path is correct. > > > >Is 'gdev[0]' freed? Should it be? > > > > > > > Yes, but I already sent a patch to fix this and your leak as well and > > Greg merged it. > > My leak? I'm confused. The one you're fixing I mean.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web