[PATCH v1 2/4] Input: atkbd - increase size of phys

From: Andy Shevchenko
Date: Fri Feb 28 2025 - 07:12:27 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/keyboard/atkbd.c:1194:9: note: ‘snprintf’ output between 8 and 39 bytes into a destination of size 32
1194 | snprintf(atkbd->phys, sizeof(atkbd->phys),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1195 | "%s/input0", atkbd->ps2dev.serio->phys);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Increase the size to cover all possible cases.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
---
drivers/input/keyboard/atkbd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index adf0f311996c..3bf76dc768be 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -206,7 +206,7 @@ struct atkbd {

/* Written only during init */
char name[64];
- char phys[32];
+ char phys[40];

unsigned short id;
unsigned short keycode[ATKBD_KEYMAP_SIZE];
--
2.47.2