[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250331-v614-v1-1-9bc69a873720@chromium.org>
Date: Mon, 31 Mar 2025 16:38:42 +0000
From: Ricardo Ribalda <ribalda@...omium.org>
To: Hans Verkuil <hverkuil@...all.nl>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Hans de Goede <hdegoede@...hat.com>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Andy Shevchenko <andy@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-staging@...ts.linux.dev, Ricardo Ribalda <ribalda@...omium.org>
Subject: [PATCH 1/2] media: cec: extron-da-hd-4k-plus: Fix
Wformat-truncation
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@...omium.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
Powered by blists - more mailing lists