Thread (6 messages) 6 messages, 3 authors, 2025-05-07

Re: [PATCH v1 1/1] Input: ALPS - bail out when device path can't fit buffer

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2025-04-28 23:30:17
Also in: lkml

Hi Andy,

On Tue, Apr 22, 2025 at 09:56:45PM +0300, Andy Shevchenko wrote:
quoted hunk ↗ jump to hunk
@@ -3094,6 +3101,16 @@ int alps_init(struct psmouse *psmouse)
 
 	if (priv->flags & ALPS_DUALPOINT) {
 		struct input_dev *dev2;
+		int n;
+
+		n = snprintf(priv->phys2, sizeof(priv->phys2), "%s/input1",
+			     psmouse->ps2dev.serio->phys);
+		if (n >= sizeof(priv->phys2)) {
+			psmouse_err(psmouse,
+				    "failed to prepare path to the trackstick device\n");
+			error = -E2BIG;
+			goto init_fail;
So you just broke touchpad of some poor guy who had it working just fine 
for many years. For maximum impact you should add BUG() or panic()
here.

In all seriousness, it is OK to have truncated phys, rarely anyone looks
at it and if we get a report of it being truncated then we can consider
addressing the size (or we can decide to live with it truncated).

Thanks.

-- 
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help