diff options
| author | Mahad Ibrahim <mahad.ibrahim.dev@gmail.com> | 2026-04-10 15:24:47 -0400 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.com> | 2026-05-12 17:33:07 +0200 |
| commit | 34b228b739f5799f434f7de35328e482d385588b (patch) | |
| tree | 8659e38033290936d9d01ff00e86a2b61ff00b5d /drivers/phy/eswin/git@git.tavy.me:linux.git | |
| parent | d97e7d7c304f87419921f740743f7baa99f40539 (diff) | |
HID: usbhid: replace strlcat with better alternatives
In preparation for the removal of the strlcat() API as per the KSPP,
replace the string concatenation logic in hid-core, usbkbd, and
usbmouse with struct seq_buf, which tracks the current write position
and remaining space internally. The changes implemented include:
- Replace device name and phys concatenation with seq_buf_puts().
- Include Struct seq_buf and its initialization.
- Include header file of seq_buf.
- Replace strlen() with seq_buf_used() on the string buffer which was
tracked by seq_buf to increase speed.
- Add size_t len in files which did not have it.
- Use of strscpy with length in place of strlcat.
Testing: This driver was compiled as a module as well as in-built in
QEMU with the QEMU basic mouse, and QEMU basic keyboard. The testing was
done in the following steps.
- Add Hardware Mouse in QEMU checking the usbhid module.
- Verify dmesg string name of mouse.
- Blacklist hidusb module from auto-loading, and removing the module via
rmmod.
- Load usbmouse module, and reattach QEMU mouse.
- Verify dmesg string name of mouse.
- Repeat same procedure on usbkbd module.
This aligns the driver with KSPP security guidelines.
Link: https://github.com/KSPP/linux/issues/370
Signed-off-by: Mahad Ibrahim <mahad.ibrahim.dev@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Diffstat (limited to 'drivers/phy/eswin/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
