Message ID | 20250331-v614-v1-1-9bc69a873720@chromium.org |
---|---|
State | New |
Headers | show |
Series | media: Fix gcc8 warnings | expand |
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); }
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(-)