* [PATCH] staging: bcm2835: Fix a memory leak in error handling path @ 2017-02-19 10:34 ` Christophe JAILLET 0 siblings, 0 replies; 15+ messages in thread From: Christophe JAILLET @ 2017-02-19 10:34 UTC (permalink / raw) To: linux-arm-kernel 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 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH] staging: bcm2835: Fix a memory leak in error handling path @ 2017-02-19 10:34 ` Christophe JAILLET 0 siblings, 0 replies; 15+ messages in thread From: Christophe JAILLET @ 2017-02-19 10:34 UTC (permalink / raw) To: mchehab, gregkh, f.fainelli, rjui, sbranden, bcm-kernel-feedback-list, swarren, lee, eric, arnd Cc: linux-media, devel, linux-rpi-kernel, linux-arm-kernel, linux-kernel, kernel-janitors, 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? --- 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 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH] staging: bcm2835: Fix a memory leak in error handling path @ 2017-02-19 10:34 ` Christophe JAILLET 0 siblings, 0 replies; 15+ messages in thread From: Christophe JAILLET @ 2017-02-19 10:34 UTC (permalink / raw) To: linux-arm-kernel 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 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH] staging: bcm2835: Fix a memory leak in error handling path 2017-02-19 10:34 ` Christophe JAILLET (?) @ 2017-02-24 12:37 ` Stefan Wahren -1 siblings, 0 replies; 15+ messages in thread From: Stefan Wahren @ 2017-02-24 12:37 UTC (permalink / raw) To: linux-arm-kernel 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]; ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] staging: bcm2835: Fix a memory leak in error handling path @ 2017-02-24 12:37 ` Stefan Wahren 0 siblings, 0 replies; 15+ messages in thread From: Stefan Wahren @ 2017-02-24 12:37 UTC (permalink / raw) To: Christophe JAILLET, mchehab, gregkh, f.fainelli, rjui, sbranden, bcm-kernel-feedback-list, swarren, lee, eric, arnd Cc: devel, kernel-janitors, linux-kernel, linux-rpi-kernel, linux-arm-kernel, linux-media 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]; ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH] staging: bcm2835: Fix a memory leak in error handling path @ 2017-02-24 12:37 ` Stefan Wahren 0 siblings, 0 replies; 15+ messages in thread From: Stefan Wahren @ 2017-02-24 12:37 UTC (permalink / raw) To: linux-arm-kernel 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]; ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] staging: bcm2835: Fix a memory leak in error handling path 2017-02-24 12:37 ` Stefan Wahren (?) @ 2017-02-24 19:57 ` Dan Carpenter -1 siblings, 0 replies; 15+ messages in thread From: Dan Carpenter @ 2017-02-24 19:57 UTC (permalink / raw) To: linux-arm-kernel 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 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] staging: bcm2835: Fix a memory leak in error handling path @ 2017-02-24 19:57 ` Dan Carpenter 0 siblings, 0 replies; 15+ messages in thread From: Dan Carpenter @ 2017-02-24 19:57 UTC (permalink / raw) To: Stefan Wahren Cc: Christophe JAILLET, mchehab, gregkh, f.fainelli, rjui, sbranden, bcm-kernel-feedback-list, swarren, lee, eric, arnd, devel, kernel-janitors, linux-kernel, linux-rpi-kernel, linux-arm-kernel, linux-media 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 ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH] staging: bcm2835: Fix a memory leak in error handling path @ 2017-02-24 19:57 ` Dan Carpenter 0 siblings, 0 replies; 15+ messages in thread From: Dan Carpenter @ 2017-02-24 19:57 UTC (permalink / raw) To: linux-arm-kernel 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 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] staging: bcm2835: Fix a memory leak in error handling path 2017-02-24 19:57 ` Dan Carpenter (?) @ 2017-02-24 21:38 ` Stefan Wahren -1 siblings, 0 replies; 15+ messages in thread From: Stefan Wahren @ 2017-02-24 21:38 UTC (permalink / raw) To: linux-arm-kernel > 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. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] staging: bcm2835: Fix a memory leak in error handling path @ 2017-02-24 21:38 ` Stefan Wahren 0 siblings, 0 replies; 15+ messages in thread From: Stefan Wahren @ 2017-02-24 21:38 UTC (permalink / raw) To: Dan Carpenter Cc: lee, rjui, linux-media, eric, kernel-janitors, arnd, linux-arm-kernel, mchehab, Christophe JAILLET, sbranden, gregkh, linux-kernel, bcm-kernel-feedback-list, devel, swarren, f.fainelli, linux-rpi-kernel > 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. ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH] staging: bcm2835: Fix a memory leak in error handling path @ 2017-02-24 21:38 ` Stefan Wahren 0 siblings, 0 replies; 15+ messages in thread From: Stefan Wahren @ 2017-02-24 21:38 UTC (permalink / raw) To: linux-arm-kernel > 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. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] staging: bcm2835: Fix a memory leak in error handling path 2017-02-24 21:38 ` Stefan Wahren (?) @ 2017-02-25 4:11 ` Dan Carpenter -1 siblings, 0 replies; 15+ messages in thread From: Dan Carpenter @ 2017-02-25 4:11 UTC (permalink / raw) To: linux-arm-kernel 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. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] staging: bcm2835: Fix a memory leak in error handling path @ 2017-02-25 4:11 ` Dan Carpenter 0 siblings, 0 replies; 15+ messages in thread From: Dan Carpenter @ 2017-02-25 4:11 UTC (permalink / raw) To: Stefan Wahren Cc: lee, rjui, linux-media, eric, kernel-janitors, arnd, linux-arm-kernel, mchehab, Christophe JAILLET, sbranden, gregkh, linux-kernel, bcm-kernel-feedback-list, devel, swarren, f.fainelli, linux-rpi-kernel 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. ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH] staging: bcm2835: Fix a memory leak in error handling path @ 2017-02-25 4:11 ` Dan Carpenter 0 siblings, 0 replies; 15+ messages in thread From: Dan Carpenter @ 2017-02-25 4:11 UTC (permalink / raw) To: linux-arm-kernel 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. ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2017-02-25 4:13 UTC | newest] Thread overview: 15+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-02-19 10:34 [PATCH] staging: bcm2835: Fix a memory leak in error handling path Christophe JAILLET 2017-02-19 10:34 ` Christophe JAILLET 2017-02-19 10:34 ` Christophe JAILLET 2017-02-24 12:37 ` Stefan Wahren 2017-02-24 12:37 ` Stefan Wahren 2017-02-24 12:37 ` Stefan Wahren 2017-02-24 19:57 ` Dan Carpenter 2017-02-24 19:57 ` Dan Carpenter 2017-02-24 19:57 ` Dan Carpenter 2017-02-24 21:38 ` Stefan Wahren 2017-02-24 21:38 ` Stefan Wahren 2017-02-24 21:38 ` Stefan Wahren 2017-02-25 4:11 ` Dan Carpenter 2017-02-25 4:11 ` Dan Carpenter 2017-02-25 4:11 ` Dan Carpenter
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.