diff mbox series

[linux-next] ipu3: use flexible-array member instead of zero-length array

Message ID 20210821034709.28061-1-jing.yangyang@zte.com.cn
State New
Headers show
Series [linux-next] ipu3: use flexible-array member instead of zero-length array | expand

Commit Message

Lv Ruyi Aug. 21, 2021, 3:47 a.m. UTC
From: jing yangyang <jing.yangyang@zte.com.cn>

Fix the following coccicheck warning:
./drivers/staging/media/ipu3/ipu3-css-fw.h:174:21-34:i
WARNING: use flexible-array member instead

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: jing yangyang <jing.yangyang@zte.com.cn>
---
 drivers/staging/media/ipu3/ipu3-css-fw.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sakari Ailus Aug. 23, 2021, 8:06 a.m. UTC | #1
Hi Jing,

On Fri, Aug 20, 2021 at 08:47:09PM -0700, CGEL wrote:
> From: jing yangyang <jing.yangyang@zte.com.cn>

> 

> Fix the following coccicheck warning:

> ./drivers/staging/media/ipu3/ipu3-css-fw.h:174:21-34:i

> WARNING: use flexible-array member instead

> 

> Reported-by: Zeal Robot <zealci@zte.com.cn>

> Signed-off-by: jing yangyang <jing.yangyang@zte.com.cn>


Thanks for the patch.

Gustavo Silva's patch "media: staging/intel-ipu3: css: Fix wrong size
comparison imgu_css_fw_init" has addressed this, and fixed another problem
as well. In other words, removing array entries from structs can have side
effects.

-- 
Kind regards,

Sakari Ailus
diff mbox series

Patch

diff --git a/drivers/staging/media/ipu3/ipu3-css-fw.h b/drivers/staging/media/ipu3/ipu3-css-fw.h
index 3c078f1..c0bc57f 100644
--- a/drivers/staging/media/ipu3/ipu3-css-fw.h
+++ b/drivers/staging/media/ipu3/ipu3-css-fw.h
@@ -171,7 +171,7 @@  struct imgu_fw_bi_file_h {
 
 struct imgu_fw_header {
 	struct imgu_fw_bi_file_h file_header;
-	struct imgu_fw_info binary_header[1];	/* binary_nr items */
+	struct imgu_fw_info binary_header[];	/* binary_nr items */
 };
 
 /******************* Firmware functions *******************/