Skip to contentSkip to conversation

media: Fix gcc8 warnings

PATCH In review Ricardo Ribalda 2 participants 4 messages Apr 1, 2025 – Apr 2, 2025

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

v2 cover media: Fix gcc8 warnings

Kernel 6.14 has increased its minimum gcc requirements. After bumping the "ancient" test in media-ci 2 new warnings have been found. Let's try to fix them.

---
Changes in v2:
- Incorporate Hans changes.
- Add comment (Thanks Andy).
- EDITME: describe what is new in this series revision.
- EDITME: use bulletpoints and terse descriptions.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Hans Verkuil (1):
media: cec: extron-da-hd-4k-plus: Fix Wformat-truncation

Ricardo Ribalda (1):
media: atomisp: Fix Wformat-truncation warning

 drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c  | 4 ++--
 drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

---
base-commit: 4e82c87058f45e79eeaa4d5bcc3b38dd3dce7209
change-id: 20250331-v614-8485d3382935

Best regards,

Signature · 1 line
Ricardo Ribalda <[email protected]>
#1 lore raw

PATCH v2 1/2 media: atomisp: Fix Wformat-truncation warning

Gcc8 is convinced that we do not have enough space in dot_id_input_bin. Extend the variable 17 bytes which is just used for debugging.

drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c:1336:9: warning: '(pipe' directive output may be truncated writing 5 bytes into a region of size between 1 and 74 [-Wformat-truncation=]

---
 drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c +2 -1
index 9818771a35e550c0ce98da826caff5f834867e7c..84220359c9576b0021ea7ac7ba13548bd77e49fd 100644
@@ -121,7 +121,8 @@ static const char *const pipe_id_to_str[] = {
 	/* [IA_CSS_PIPE_ID_YUVPP]     =*/ "yuvpp",
 };
 
-static char dot_id_input_bin[SH_CSS_MAX_BINARY_NAME + 10];
+/* 27 is combined length of _stage%d(pipe%d)\0. */
+static char dot_id_input_bin[SH_CSS_MAX_BINARY_NAME + 27];
 static char ring_buffer[200];
 
 void ia_css_debug_dtrace(unsigned int level, const char *fmt, ...)
Signature · 1 line
2.49.0.472.ge94155a9ec-goog
maintainer Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] media: atomisp: Fix Wformat-truncation warning

Quoted 4 lines · Ricardo Ribalda

Gcc8 is convinced that we do not have enough space in dot_id_input_bin. Extend the variable 17 bytes which is just used for debugging.

drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c:1336:9: warning: '(pipe' directive output may be truncated writing 5 bytes into a region of size between 1 and 74 [-Wformat-truncation=]

Note, you may drop the drivers/staging/media/ as the driver is unique enough.

...

You also want to send this patch separately since the AtomISP has its own MAINTAINERS record (and there are patches in the queue there, IIRC).

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw

PATCH v2 2/2 media: cec: extron-da-hd-4k-plus: Fix Wformat-truncation

In reply to Ricardo Ribalda

From: Hans Verkuil <[email protected]>

Fix gcc8 warning:

drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c:1014:44: warning: 'DCEC' directive output may be truncated writing 4 bytes into a region of size between 0 and 53 [-Wformat-truncation=]

Resizing the 'buf' and 'cmd' arrays fixed the warning.

---
 drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c +2 -2
index cfbfc4c1b2e67fec9434aa6852ab465ad8c11225..41d019b01ec09d1d3e72c89155042888b7948463 100644
@@ -1002,8 +1002,8 @@ static int extron_cec_adap_transmit(struct cec_adapter *adap, u8 attempts,
 				    u32 signal_free_time, struct cec_msg *msg)
 {
 	struct extron_port *port = cec_get_drvdata(adap);
-	char buf[CEC_MAX_MSG_SIZE * 3 + 1];
-	char cmd[CEC_MAX_MSG_SIZE * 3 + 13];
+	char buf[(CEC_MAX_MSG_SIZE - 1) * 3 + 1];
+	char cmd[sizeof(buf) + 14];
 	unsigned int i;
 
 	if (port->disconnected)
Signature · 1 line
2.49.0.472.ge94155a9ec-goog