Linux kernel staging patches
 help / color / mirror / Atom feed
* [PATCH] media: atomisp: Add check for rgby_data memory allocation failure
@ 2024-11-01 15:48 Li Huafei
  2024-11-01  8:30 ` Andy Shevchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Li Huafei @ 2024-11-01 15:48 UTC (permalink / raw)
  To: mchehab
  Cc: andy, hdegoede, sakari.ailus, gregkh, linux-media, linux-staging,
	linux-kernel, lihuafei1

In ia_css_3a_statistics_allocate(), there is no check on the allocation
result of the rgby_data memory. If rgby_data is not successfully
allocated, it may trigger the assert(host_stats->rgby_data) assertion in
ia_css_s3a_hmem_decode(). Adding a check to fix this potential issue.

Fixes: ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")
Signed-off-by: Li Huafei <lihuafei1@huawei.com>
---
 drivers/staging/media/atomisp/pci/sh_css_params.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/staging/media/atomisp/pci/sh_css_params.c
index 232744973ab8..b1feb6f6ebe8 100644
--- a/drivers/staging/media/atomisp/pci/sh_css_params.c
+++ b/drivers/staging/media/atomisp/pci/sh_css_params.c
@@ -4181,6 +4181,8 @@ ia_css_3a_statistics_allocate(const struct ia_css_3a_grid_info *grid)
 		goto err;
 	/* No weighted histogram, no structure, treat the histogram data as a byte dump in a byte array */
 	me->rgby_data = kvmalloc(sizeof_hmem(HMEM0_ID), GFP_KERNEL);
+	if (!me->rgby_data)
+		goto err;
 
 	IA_CSS_LEAVE("return=%p", me);
 	return me;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-11-04  7:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-01 15:48 [PATCH] media: atomisp: Add check for rgby_data memory allocation failure Li Huafei
2024-11-01  8:30 ` Andy Shevchenko
2024-11-01  9:57   ` Li Huafei
2024-11-01 10:16     ` Andy Shevchenko
2024-11-01 10:55       ` Andy Shevchenko
2024-11-04  7:30         ` Li Huafei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox