From: George Karagounis <taterraster@gmail.com>
To: Jiri Kosina <jikos@kernel.org>, Benjamin Tissoires <bentiss@kernel.org>
Cc: "Filipe Laíns" <lains@riseup.net>,
"Bastien Nocera" <hadess@hadess.net>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
mail@taterr.org
Subject: [PATCH v2 1/3] HID: haptic: Replace create_singlethread_workqueue with alloc_ordered_workqueue
Date: Wed, 28 Oct 2026 22:08:37 +0200 [thread overview]
Message-ID: <20261028200839.202670-2-mail@taterr.org> (raw)
In-Reply-To: <20261028200839.202670-1-mail@taterr.org>
create_singlethread_workqueue() is deprecated. Replace it with
alloc_ordered_workqueue() for the haptic workqueue.
Pass the format string directly to alloc_ordered_workqueue() to avoid
a format string vulnerability where hdev->name could contain % specifiers.
This also eliminates the need for the intermediate kmalloc/sprintf.
Use flags=0 as this workqueue only transmits output reports and is
not part of the memory reclaim path.
Signed-off-by: George Karagounis <mail@taterr.org>
---
drivers/hid/hid-haptic.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/hid/hid-haptic.c b/drivers/hid/hid-haptic.c
index 8760eeb08b2c..c3aa7db44766 100644
--- a/drivers/hid/hid-haptic.c
+++ b/drivers/hid/hid-haptic.c
@@ -418,7 +418,6 @@ int hid_haptic_init(struct hid_device *hdev,
.hid_usage = HID_HP_WAVEFORMSTOP & HID_USAGE,
};
const char *prefix = "hid-haptic";
- char *name;
int (*flush)(struct input_dev *dev, struct file *file);
int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value);
@@ -457,12 +456,7 @@ int hid_haptic_init(struct hid_device *hdev,
haptic->manual_trigger_report_len =
hid_report_len(haptic->manual_trigger_report);
mutex_init(&haptic->manual_trigger_mutex);
- name = kmalloc(strlen(prefix) + strlen(hdev->name) + 2, GFP_KERNEL);
- if (name) {
- sprintf(name, "%s %s", prefix, hdev->name);
- haptic->wq = create_singlethread_workqueue(name);
- kfree(name);
- }
+ haptic->wq = alloc_ordered_workqueue("%s %s", 0, prefix, hdev->name);
if (!haptic->wq) {
ret = -ENOMEM;
goto duration_map;
--
2.56.0
next prev parent reply other threads:[~2026-10-28 20:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 20:08 [PATCH v2 0/3] HID: Replace deprecated create_singlethread_workqueue George Karagounis
2026-10-28 20:08 ` George Karagounis [this message]
2026-10-28 20:08 ` [PATCH v2 2/3] HID: elo: Replace create_singlethread_workqueue with alloc_ordered_workqueue George Karagounis
2026-10-28 20:08 ` [PATCH v2 3/3] HID: logitech-hidpp: " George Karagounis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261028200839.202670-2-mail@taterr.org \
--to=taterraster@gmail.com \
--cc=bentiss@kernel.org \
--cc=hadess@hadess.net \
--cc=jikos@kernel.org \
--cc=lains@riseup.net \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mail@taterr.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox