* [PATCH 6/9] Input: IMS: fix printf string overflow
2024-03-26 22:37 [PATCH 0/9] enabled -Wformat-truncation for clang Arnd Bergmann
@ 2024-03-26 22:38 ` Arnd Bergmann
2024-03-28 20:29 ` Dmitry Torokhov
2024-03-27 0:47 ` [PATCH 0/9] enabled -Wformat-truncation for clang Jakub Kicinski
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Arnd Bergmann @ 2024-03-26 22:38 UTC (permalink / raw)
To: llvm, Dmitry Torokhov, Nathan Chancellor
Cc: Arnd Bergmann, Nick Desaulniers, Bill Wendling, Justin Stitt,
ye xingchen, linux-input, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
clang warns about a string overflow in this driver
drivers/input/misc/ims-pcu.c:1802:2: error: 'snprintf' will always be truncated; specified size is 10, but format string expands to at least 12 [-Werror,-Wformat-truncation]
drivers/input/misc/ims-pcu.c:1814:2: error: 'snprintf' will always be truncated; specified size is 10, but format string expands to at least 12 [-Werror,-Wformat-truncation]
Make the buffer a little longer to ensure it always fits.
Fixes: 628329d52474 ("Input: add IMS Passenger Control Unit driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/input/misc/ims-pcu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
index 6e8cc28debd9..80d16c92a08b 100644
--- a/drivers/input/misc/ims-pcu.c
+++ b/drivers/input/misc/ims-pcu.c
@@ -42,8 +42,8 @@ struct ims_pcu_backlight {
#define IMS_PCU_PART_NUMBER_LEN 15
#define IMS_PCU_SERIAL_NUMBER_LEN 8
#define IMS_PCU_DOM_LEN 8
-#define IMS_PCU_FW_VERSION_LEN (9 + 1)
-#define IMS_PCU_BL_VERSION_LEN (9 + 1)
+#define IMS_PCU_FW_VERSION_LEN 16
+#define IMS_PCU_BL_VERSION_LEN 16
#define IMS_PCU_BL_RESET_REASON_LEN (2 + 1)
#define IMS_PCU_PCU_B_DEVICE_ID 5
--
2.39.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 6/9] Input: IMS: fix printf string overflow
2024-03-26 22:38 ` [PATCH 6/9] Input: IMS: fix printf string overflow Arnd Bergmann
@ 2024-03-28 20:29 ` Dmitry Torokhov
0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2024-03-28 20:29 UTC (permalink / raw)
To: Arnd Bergmann
Cc: llvm, Nathan Chancellor, Arnd Bergmann, Nick Desaulniers,
Bill Wendling, Justin Stitt, ye xingchen, linux-input,
linux-kernel
On Tue, Mar 26, 2024 at 11:38:05PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> clang warns about a string overflow in this driver
>
> drivers/input/misc/ims-pcu.c:1802:2: error: 'snprintf' will always be truncated; specified size is 10, but format string expands to at least 12 [-Werror,-Wformat-truncation]
> drivers/input/misc/ims-pcu.c:1814:2: error: 'snprintf' will always be truncated; specified size is 10, but format string expands to at least 12 [-Werror,-Wformat-truncation]
>
> Make the buffer a little longer to ensure it always fits.
>
> Fixes: 628329d52474 ("Input: add IMS Passenger Control Unit driver")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Applied, thank you.
--
Dmitry
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/9] enabled -Wformat-truncation for clang
2024-03-26 22:37 [PATCH 0/9] enabled -Wformat-truncation for clang Arnd Bergmann
2024-03-26 22:38 ` [PATCH 6/9] Input: IMS: fix printf string overflow Arnd Bergmann
@ 2024-03-27 0:47 ` Jakub Kicinski
2024-03-29 19:30 ` patchwork-bot+netdevbpf
2024-04-02 1:48 ` (subset) " Martin K. Petersen
3 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2024-03-27 0:47 UTC (permalink / raw)
To: Arnd Bergmann
Cc: llvm, Arnd Bergmann, Dmitry Torokhov, Claudiu Manoil,
Vladimir Oltean, Saeed Mahameed, Leon Romanovsky, Ariel Elior,
Manish Chopra, Hans de Goede, Ilpo Järvinen, Maximilian Luz,
Hannes Reinecke, Martin K. Petersen, Helge Deller,
Masahiro Yamada, Nathan Chancellor, Nicolas Schier, Johannes Berg,
Jaroslav Kysela, Takashi Iwai, Nick Desaulniers, Bill Wendling,
Justin Stitt, linux-input, linux-kernel, netdev, linux-rdma,
platform-driver-x86, linux-scsi, linux-fbdev, dri-devel,
linux-kbuild, linuxppc-dev, alsa-devel, linux-sound
On Tue, 26 Mar 2024 23:37:59 +0100 Arnd Bergmann wrote:
> I hope that the patches can get picked up by platform maintainers
> directly, so the final patch can go in later on.
platform == subsystem? :)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/9] enabled -Wformat-truncation for clang
2024-03-26 22:37 [PATCH 0/9] enabled -Wformat-truncation for clang Arnd Bergmann
2024-03-26 22:38 ` [PATCH 6/9] Input: IMS: fix printf string overflow Arnd Bergmann
2024-03-27 0:47 ` [PATCH 0/9] enabled -Wformat-truncation for clang Jakub Kicinski
@ 2024-03-29 19:30 ` patchwork-bot+netdevbpf
2024-04-02 1:48 ` (subset) " Martin K. Petersen
3 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-03-29 19:30 UTC (permalink / raw)
To: Arnd Bergmann
Cc: llvm, arnd, dmitry.torokhov, claudiu.manoil, vladimir.oltean,
kuba, saeedm, leon, aelior, manishc, hdegoede, ilpo.jarvinen,
luzmaximilian, hare, martin.petersen, deller, masahiroy, nathan,
nicolas, johannes, perex, tiwai, ndesaulniers, morbo, justinstitt,
linux-input, linux-kernel, netdev, linux-rdma,
platform-driver-x86, linux-scsi, linux-fbdev, dri-devel,
linux-kbuild, linuxppc-dev, alsa-devel, linux-sound
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 26 Mar 2024 23:37:59 +0100 you wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> With randconfig build testing, I found only eight files that produce
> warnings with clang when -Wformat-truncation is enabled. This means
> we can just turn it on by default rather than only enabling it for
> "make W=1".
>
> [...]
Here is the summary with links:
- [2/9] enetc: avoid truncating error message
https://git.kernel.org/netdev/net-next/c/9046d581ed58
- [3/9] qed: avoid truncating work queue length
https://git.kernel.org/netdev/net-next/c/954fd908f177
- [4/9] mlx5: avoid truncating error message
https://git.kernel.org/netdev/net-next/c/b324a960354b
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: (subset) [PATCH 0/9] enabled -Wformat-truncation for clang
2024-03-26 22:37 [PATCH 0/9] enabled -Wformat-truncation for clang Arnd Bergmann
` (2 preceding siblings ...)
2024-03-29 19:30 ` patchwork-bot+netdevbpf
@ 2024-04-02 1:48 ` Martin K. Petersen
3 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2024-04-02 1:48 UTC (permalink / raw)
To: llvm, Arnd Bergmann
Cc: Martin K . Petersen, Arnd Bergmann, Dmitry Torokhov,
Claudiu Manoil, Vladimir Oltean, Jakub Kicinski, Saeed Mahameed,
Leon Romanovsky, Ariel Elior, Manish Chopra, Hans de Goede,
Ilpo Järvinen, Maximilian Luz, Hannes Reinecke, Helge Deller,
Masahiro Yamada, Nathan Chancellor, Nicolas Schier, Johannes Berg,
Jaroslav Kysela, Takashi Iwai, Nick Desaulniers, Bill Wendling,
Justin Stitt, linux-input, linux-kernel, netdev, linux-rdma,
platform-driver-x86, linux-scsi, linux-fbdev, dri-devel,
linux-kbuild, linuxppc-dev, alsa-devel, linux-sound
On Tue, 26 Mar 2024 23:37:59 +0100, Arnd Bergmann wrote:
> With randconfig build testing, I found only eight files that produce
> warnings with clang when -Wformat-truncation is enabled. This means
> we can just turn it on by default rather than only enabling it for
> "make W=1".
>
> Unfortunately, gcc produces a lot more warnings when the option
> is enabled, so it's not yet possible to turn it on both both
> compilers.
>
> [...]
Applied to 6.9/scsi-fixes, thanks!
[7/9] scsi: mylex: fix sysfs buffer lengths
https://git.kernel.org/mkp/scsi/c/1197c5b2099f
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 6+ messages in thread