[PATCH v1 4/4] Input: psmouse - increase size of phys
From: Andy Shevchenko
Date: Fri Feb 28 2025 - 07:12:12 EST
When creating a physical device name in the driver the snprintf() takes
an up to 32 characters argument along with the additional 8 characters
and tries to pack this into 32 bytes array. GCC complains about that
when build with `make W=1`:
drivers/input/mouse/psmouse-base.c:1603:9: note: ‘snprintf’ output between 8 and 39 bytes into a destination of size 32
1603 | snprintf(psmouse->phys, sizeof(psmouse->phys), "%s/input0", serio->phys);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Increase the size to cover all possible cases.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
---
drivers/input/mouse/psmouse.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h
index 4d8acfe0d82a..8422ee8243bb 100644
--- a/drivers/input/mouse/psmouse.h
+++ b/drivers/input/mouse/psmouse.h
@@ -107,7 +107,7 @@ struct psmouse {
unsigned long num_resyncs;
enum psmouse_state state;
char devname[64];
- char phys[32];
+ char phys[40];
unsigned int rate;
unsigned int resolution;
--
2.47.2