mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
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: 7b9b77a8bb ("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>
This commit is contained in:
committed by
Bartosz Golaszewski
parent
4f61d7fdcb
commit
a22c9dc26d
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user