From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Vincent MAILHOL <mailhol.vincent@wanadoo.fr>,
linux-can <linux-can@vger.kernel.org>
Subject: etas_es58x warnings with gcc-13
Date: Thu, 14 Sep 2023 10:23:49 +0200 [thread overview]
Message-ID: <20230914-carrousel-wrecker-720a08e173e9-mkl@pengutronix.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 3692 bytes --]
Hello Vincent,
when compiling the etas driver with gcc version 13.2.0 (Debian
13.2.0-2) and W=1, it fails with:
| drivers/net/can/usb/etas_es58x/es58x_devlink.c: In function ‘es58x_devlink_info_get’:
| drivers/net/can/usb/etas_es58x/es58x_devlink.c:201:55: error: ‘%02u’ directive output may be truncated writing between 2 and 3 bytes into a region of size between 1 and 3 [-Werror=format-truncation=]
| 201 | snprintf(buf, sizeof(buf), "%02u.%02u.%02u",
| | ^~~~
| drivers/net/can/usb/etas_es58x/es58x_devlink.c:201:44: note: directive argument in the range [0, 255]
| 201 | snprintf(buf, sizeof(buf), "%02u.%02u.%02u",
| | ^~~~~~~~~~~~~~~~
| drivers/net/can/usb/etas_es58x/es58x_devlink.c:201:17: note: ‘snprintf’ output between 9 and 12 bytes into a destination of size 9
| 201 | snprintf(buf, sizeof(buf), "%02u.%02u.%02u",
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 202 | fw_ver->major, fw_ver->minor, fw_ver->revision);
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| drivers/net/can/usb/etas_es58x/es58x_devlink.c:211:55: error: ‘%02u’ directive output may be truncated writing between 2 and 3 bytes into a region of size between 1 and 3 [-Werror=format-truncation=]
| 211 | snprintf(buf, sizeof(buf), "%02u.%02u.%02u",
| | ^~~~
| drivers/net/can/usb/etas_es58x/es58x_devlink.c:211:44: note: directive argument in the range [0, 255]
| 211 | snprintf(buf, sizeof(buf), "%02u.%02u.%02u",
| | ^~~~~~~~~~~~~~~~
| drivers/net/can/usb/etas_es58x/es58x_devlink.c:211:17: note: ‘snprintf’ output between 9 and 12 bytes into a destination of size 9
| 211 | snprintf(buf, sizeof(buf), "%02u.%02u.%02u",
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 212 | bl_ver->major, bl_ver->minor, bl_ver->revision);
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| drivers/net/can/usb/etas_es58x/es58x_devlink.c:221:52: error: ‘%03u’ directive output may be truncated writing between 3 and 5 bytes into a region of size between 2 and 4 [-Werror=format-truncation=]
| 221 | snprintf(buf, sizeof(buf), "%c%03u/%03u",
| | ^~~~
| drivers/net/can/usb/etas_es58x/es58x_devlink.c:221:44: note: directive argument in the range [0, 65535]
| 221 | snprintf(buf, sizeof(buf), "%c%03u/%03u",
| | ^~~~~~~~~~~~~
| drivers/net/can/usb/etas_es58x/es58x_devlink.c:221:17: note: ‘snprintf’ output between 9 and 13 bytes into a destination of size 9
| 221 | snprintf(buf, sizeof(buf), "%c%03u/%03u",
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 222 | hw_rev->letter, hw_rev->major, hw_rev->minor);
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| cc1: all warnings being treated as errors
Can you create a fix?
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next reply other threads:[~2023-09-14 8:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-14 8:23 Marc Kleine-Budde [this message]
2023-09-14 8:53 ` etas_es58x warnings with gcc-13 Vincent MAILHOL
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230914-carrousel-wrecker-720a08e173e9-mkl@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=linux-can@vger.kernel.org \
--cc=mailhol.vincent@wanadoo.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).