diff options
| author | Arnd Bergmann <[email protected]> | 2024-10-28 14:21:46 +0000 |
|---|---|---|
| committer | Bartosz Golaszewski <[email protected]> | 2024-10-31 12:43:09 +0000 |
| commit | a22c9dc26d6fc522357b73858b13e29c58f49d64 (patch) | |
| tree | 8f6c9b6ad1c330efdb2fc3081473e8bc9d9f26ab /drivers/gpio/gpiolib-cdev.c | |
| parent | gpio: dwapb: Add ACPI HID for DWAPB GPIO controller on Fujitsu MONAKA (diff) | |
| download | kernel-a22c9dc26d6fc522357b73858b13e29c58f49d64.tar.gz kernel-a22c9dc26d6fc522357b73858b13e29c58f49d64.zip | |
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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Bartosz Golaszewski <[email protected]>
Diffstat (limited to 'drivers/gpio/gpiolib-cdev.c')
| -rw-r--r-- | drivers/gpio/gpiolib-cdev.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c index 0ec162b0ea04..088201de9627 100644 --- a/drivers/gpio/gpiolib-cdev.c +++ b/drivers/gpio/gpiolib-cdev.c @@ -2810,8 +2810,8 @@ int gpiolib_cdev_register(struct gpio_device *gdev, dev_t devt) gdev->chrdev.owner = THIS_MODULE; gdev->dev.devt = MKDEV(MAJOR(devt), gdev->id); - gdev->line_state_wq = alloc_ordered_workqueue(dev_name(&gdev->dev), - WQ_HIGHPRI); + gdev->line_state_wq = alloc_ordered_workqueue("%s", WQ_HIGHPRI, + dev_name(&gdev->dev)); if (!gdev->line_state_wq) return -ENOMEM; |
