* [PATCH 0/2] media: Fix gcc8 warnings
@ 2025-03-31 16:38 Ricardo Ribalda
2025-03-31 16:38 ` [PATCH 1/2] media: cec: extron-da-hd-4k-plus: Fix Wformat-truncation Ricardo Ribalda
2025-03-31 16:38 ` [PATCH 2/2] media: atomisp: Fix Wformat-truncation warning Ricardo Ribalda
0 siblings, 2 replies; 5+ messages in thread
From: Ricardo Ribalda @ 2025-03-31 16:38 UTC (permalink / raw)
To: Hans Verkuil, Mauro Carvalho Chehab, Hans de Goede, Sakari Ailus,
Andy Shevchenko, Greg Kroah-Hartman
Cc: linux-media, linux-kernel, linux-staging, Ricardo Ribalda
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.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
Ricardo Ribalda (2):
media: cec: extron-da-hd-4k-plus: Fix Wformat-truncation
media: atomisp: Fix Wformat-truncation warning
drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c | 5 +++--
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
---
base-commit: 4e82c87058f45e79eeaa4d5bcc3b38dd3dce7209
change-id: 20250331-v614-8485d3382935
Best regards,
--
Ricardo Ribalda <ribalda@chromium.org>
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 1/2] media: cec: extron-da-hd-4k-plus: Fix Wformat-truncation 2025-03-31 16:38 [PATCH 0/2] media: Fix gcc8 warnings Ricardo Ribalda @ 2025-03-31 16:38 ` Ricardo Ribalda 2025-04-01 7:46 ` Hans Verkuil 2025-03-31 16:38 ` [PATCH 2/2] media: atomisp: Fix Wformat-truncation warning Ricardo Ribalda 1 sibling, 1 reply; 5+ messages in thread From: Ricardo Ribalda @ 2025-03-31 16:38 UTC (permalink / raw) To: Hans Verkuil, Mauro Carvalho Chehab, Hans de Goede, Sakari Ailus, Andy Shevchenko, Greg Kroah-Hartman Cc: linux-media, linux-kernel, linux-staging, Ricardo Ribalda Convince gcc8 that the port, initiator and destination fits in a single char, despite the fact that they are 4 bits wide. 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=] Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> --- drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c b/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c index cfbfc4c1b2e67fec9434aa6852ab465ad8c11225..e1a2a676bcaf9c313041ce8074c85636cfe4b2da 100644 --- a/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c +++ b/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c @@ -1012,8 +1012,9 @@ static int extron_cec_adap_transmit(struct cec_adapter *adap, u8 attempts, for (i = 0; i < msg->len - 1; i++) sprintf(buf + i * 3, "%%%02X", msg->msg[i + 1]); snprintf(cmd, sizeof(cmd), "W%c%u*%u*%u*%sDCEC", - port->direction, port->port.port, - cec_msg_initiator(msg), cec_msg_destination(msg), buf); + port->direction, port->port.port % 10, + cec_msg_initiator(msg) % 10, cec_msg_destination(msg) % 10, + buf); return extron_send_and_wait(port->extron, port, cmd, NULL); } -- 2.49.0.472.ge94155a9ec-goog ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] media: cec: extron-da-hd-4k-plus: Fix Wformat-truncation 2025-03-31 16:38 ` [PATCH 1/2] media: cec: extron-da-hd-4k-plus: Fix Wformat-truncation Ricardo Ribalda @ 2025-04-01 7:46 ` Hans Verkuil 0 siblings, 0 replies; 5+ messages in thread From: Hans Verkuil @ 2025-04-01 7:46 UTC (permalink / raw) To: Ricardo Ribalda, Mauro Carvalho Chehab, Hans de Goede, Sakari Ailus, Andy Shevchenko, Greg Kroah-Hartman Cc: linux-media, linux-kernel, linux-staging On 31/03/2025 18:38, Ricardo Ribalda wrote: > Convince gcc8 that the port, initiator and destination fits in a single > char, despite the fact that they are 4 bits wide. > > 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=] > > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> > --- > drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c b/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c > index cfbfc4c1b2e67fec9434aa6852ab465ad8c11225..e1a2a676bcaf9c313041ce8074c85636cfe4b2da 100644 > --- a/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c > +++ b/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c > @@ -1012,8 +1012,9 @@ static int extron_cec_adap_transmit(struct cec_adapter *adap, u8 attempts, > for (i = 0; i < msg->len - 1; i++) > sprintf(buf + i * 3, "%%%02X", msg->msg[i + 1]); > snprintf(cmd, sizeof(cmd), "W%c%u*%u*%u*%sDCEC", > - port->direction, port->port.port, > - cec_msg_initiator(msg), cec_msg_destination(msg), buf); > + port->direction, port->port.port % 10, > + cec_msg_initiator(msg) % 10, cec_msg_destination(msg) % 10, This is definitely wrong, since initiator/destination is a value from 0-15. So % 10 will mess that up. I'm preparing a patch of my own for this. Regards, Hans > + buf); > return extron_send_and_wait(port->extron, port, cmd, NULL); > } > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] media: atomisp: Fix Wformat-truncation warning 2025-03-31 16:38 [PATCH 0/2] media: Fix gcc8 warnings Ricardo Ribalda 2025-03-31 16:38 ` [PATCH 1/2] media: cec: extron-da-hd-4k-plus: Fix Wformat-truncation Ricardo Ribalda @ 2025-03-31 16:38 ` Ricardo Ribalda 2025-04-01 13:03 ` Andy Shevchenko 1 sibling, 1 reply; 5+ messages in thread From: Ricardo Ribalda @ 2025-03-31 16:38 UTC (permalink / raw) To: Hans Verkuil, Mauro Carvalho Chehab, Hans de Goede, Sakari Ailus, Andy Shevchenko, Greg Kroah-Hartman Cc: linux-media, linux-kernel, linux-staging, Ricardo Ribalda Gcc8 is convinced that we do not have enough space in dot_id_input_bin. Extend the variable 17 bytes. It 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=] Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> --- drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c index 9818771a35e550c0ce98da826caff5f834867e7c..45af23f09c0ae67a2dd62e79457b548831b8c21e 100644 --- a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c +++ b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c @@ -121,7 +121,7 @@ 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]; +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, ...) -- 2.49.0.472.ge94155a9ec-goog ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] media: atomisp: Fix Wformat-truncation warning 2025-03-31 16:38 ` [PATCH 2/2] media: atomisp: Fix Wformat-truncation warning Ricardo Ribalda @ 2025-04-01 13:03 ` Andy Shevchenko 0 siblings, 0 replies; 5+ messages in thread From: Andy Shevchenko @ 2025-04-01 13:03 UTC (permalink / raw) To: Ricardo Ribalda Cc: Hans Verkuil, Mauro Carvalho Chehab, Hans de Goede, Sakari Ailus, Andy Shevchenko, Greg Kroah-Hartman, linux-media, linux-kernel, linux-staging On Mon, Mar 31, 2025 at 7:38 PM Ricardo Ribalda <ribalda@chromium.org> wrote: > > Gcc8 is convinced that we do not have enough space in dot_id_input_bin. > Extend the variable 17 bytes. It 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=] ... > -static char dot_id_input_bin[SH_CSS_MAX_BINARY_NAME + 10]; > +static char dot_id_input_bin[SH_CSS_MAX_BINARY_NAME + 27]; I'm okay with the approach, but can you also add a comment to explain 27, please? (I mean something like "27 is the combined length of 'pipe' plus ...") -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-04-01 13:04 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-03-31 16:38 [PATCH 0/2] media: Fix gcc8 warnings Ricardo Ribalda 2025-03-31 16:38 ` [PATCH 1/2] media: cec: extron-da-hd-4k-plus: Fix Wformat-truncation Ricardo Ribalda 2025-04-01 7:46 ` Hans Verkuil 2025-03-31 16:38 ` [PATCH 2/2] media: atomisp: Fix Wformat-truncation warning Ricardo Ribalda 2025-04-01 13:03 ` Andy Shevchenko
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox