etas_es58x warnings with gcc-13

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: signature.asc
Description: PGP signature


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux