* [PATCH] media: atomisp: Fix memory leak in atomisp_alloc_dis_coef_buf
@ 2026-10-26 17:58 Abdullah Mohammd Sifat
2026-10-27 5:40 ` Dan Carpenter
0 siblings, 1 reply; 4+ messages in thread
From: Abdullah Mohammd Sifat @ 2026-10-26 17:58 UTC (permalink / raw)
To: dan.carpenter, hansg, mchehab, gregkh
Cc: linux-media, linux-staging, linux-kernel, Abdullah Mohammd Sifat
Free the allocated dvs2_coeff memory if ia_css_dvs2_statistics_allocate
fails to prevent a memory leak in the error path.
Signed-off-by: Abdullah Mohammd Sifat <sifat.yt.2.0c@gmail.com>
---
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
index eacd7ee5c050..48196a358ad9 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
@@ -1373,8 +1373,12 @@ int atomisp_alloc_dis_coef_buf(struct atomisp_sub_device *asd)
/* DIS projections. */
asd->params.dis_proj_data_valid = false;
asd->params.dvs_stat = ia_css_dvs2_statistics_allocate(dvs_grid);
- if (!asd->params.dvs_stat)
+ if (!asd->params.dvs_stat) {
+ ia_css_dvs2_coefficients_free(asd->params.css_param.dvs2_coeff);
+ asd->params.css_param.dvs2_coeff = NULL;
return -ENOMEM;
+ }
+
asd->params.dvs_hor_proj_bytes =
dvs_grid->aligned_height * dvs_grid->aligned_width *
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] media: atomisp: Fix memory leak in atomisp_alloc_dis_coef_buf
2026-10-26 17:58 [PATCH] media: atomisp: Fix memory leak in atomisp_alloc_dis_coef_buf Abdullah Mohammd Sifat
@ 2026-10-27 5:40 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2026-10-27 5:40 UTC (permalink / raw)
To: Abdullah Mohammd Sifat
Cc: dan.carpenter, hansg, mchehab, gregkh, linux-media,
linux-staging, linux-kernel
On Mon, Oct 26, 2026 at 05:58:39PM +0000, Abdullah Mohammd Sifat wrote:
> Free the allocated dvs2_coeff memory if ia_css_dvs2_statistics_allocate
>
> fails to prevent a memory leak in the error path.
Extra blank line is strange.
>
> Signed-off-by: Abdullah Mohammd Sifat <sifat.yt.2.0c@gmail.com>
> ---
See my comments to the other thread. This is a false positive.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] media: atomisp: Fix memory leak in atomisp_alloc_dis_coef_buf
2026-10-27 0:19 Abdullah Mohammd Sifat
@ 2026-10-27 5:38 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2026-10-27 5:38 UTC (permalink / raw)
To: Abdullah Mohammd Sifat
Cc: dan.carpenter, hansg, mchehab, gregkh, linux-media,
linux-staging, linux-kernel
On Tue, Oct 27, 2026 at 12:19:40AM +0000, Abdullah Mohammd Sifat wrote:
> Free the allocated dvs2_coeff memory if ia_css_dvs2_statistics_allocate
>
> fails to prevent a memory leak in the error path.
>
> Signed-off-by: Abdullah Mohammd Sifat <sifat.yt.2.0c@gmail.com>
The commit message says it is a bug but there is no Fixes tag.
However, it is not a bug because the memory is freed in the caller.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] media: atomisp: Fix memory leak in atomisp_alloc_dis_coef_buf
@ 2026-10-27 0:19 Abdullah Mohammd Sifat
2026-10-27 5:38 ` Dan Carpenter
0 siblings, 1 reply; 4+ messages in thread
From: Abdullah Mohammd Sifat @ 2026-10-27 0:19 UTC (permalink / raw)
To: error27, dan.carpenter, hansg, mchehab, gregkh
Cc: linux-media, linux-staging, linux-kernel, Abdullah Mohammd Sifat
Free the allocated dvs2_coeff memory if ia_css_dvs2_statistics_allocate
fails to prevent a memory leak in the error path.
Signed-off-by: Abdullah Mohammd Sifat <sifat.yt.2.0c@gmail.com>
---
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
index eacd7ee5c050..48196a358ad9 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
@@ -1373,8 +1373,12 @@ int atomisp_alloc_dis_coef_buf(struct atomisp_sub_device *asd)
/* DIS projections. */
asd->params.dis_proj_data_valid = false;
asd->params.dvs_stat = ia_css_dvs2_statistics_allocate(dvs_grid);
- if (!asd->params.dvs_stat)
+ if (!asd->params.dvs_stat) {
+ ia_css_dvs2_coefficients_free(asd->params.css_param.dvs2_coeff);
+ asd->params.css_param.dvs2_coeff = NULL;
return -ENOMEM;
+ }
+
asd->params.dvs_hor_proj_bytes =
dvs_grid->aligned_height * dvs_grid->aligned_width *
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-27 5:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-26 17:58 [PATCH] media: atomisp: Fix memory leak in atomisp_alloc_dis_coef_buf Abdullah Mohammd Sifat
2026-10-27 5:40 ` Dan Carpenter
2026-10-27 0:19 Abdullah Mohammd Sifat
2026-10-27 5:38 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®