]> www.infradead.org Git - users/jedix/linux-maple.git/commit
gpiolib: avoid format string weakness in workqueue interface
authorArnd Bergmann <arnd@arndb.de>
Mon, 28 Oct 2024 14:21:46 +0000 (14:21 +0000)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Thu, 31 Oct 2024 12:43:09 +0000 (13:43 +0100)
commita22c9dc26d6fc522357b73858b13e29c58f49d64
tree8f6c9b6ad1c330efdb2fc3081473e8bc9d9f26ab
parent4f61d7fdcbc422f82acddf33cc966a13de577ce1
gpiolib: avoid format string weakness in workqueue interface

Using a string literal as a format string is a possible bug when the
string contains '%' characters:

drivers/gpio/gpiolib-cdev.c:2813:48: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]
 2813 |         gdev->line_state_wq = alloc_ordered_workqueue(dev_name(&gdev->dev),
      |                                                       ^~~~~~~~~~~~~~~~~~~~
drivers/gpio/gpiolib-cdev.c:2813:48: note: treat the string as an argument to avoid this
 2813 |         gdev->line_state_wq = alloc_ordered_workqueue(dev_name(&gdev->dev),
      |                                                       ^
      |                                                       "%s",

Do as clang suggests and use a trivial "%s" format string.

Fixes: 7b9b77a8bba9 ("gpiolib: add a per-gpio_device line state notification workqueue")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20241028142152.750650-1-arnd@kernel.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/gpiolib-cdev.c