NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/59875: typo in src/sys/dev/pckbc/synaptics.c



>Number:         59875
>Category:       kern
>Synopsis:       typo in src/sys/dev/pckbc/synaptics.c
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 01 12:50:00 +0000 2026
>Originator:     Izumi Tsutsui
>Release:        NetBSD 10.1
>Organization:
>Environment:
System: NetBSD mirage 10.1 NetBSD 10.1 (GENERIC) #0: Mon Dec 16 13:08:11 UTC 2024 mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
src/sys/dev/pckbport/symaptics.c has the following code block:

```
	/*
	 * Clamp deltas to specified maximums.
	 */
	if (abs(dx) > synaptics_max_speed_x)
		dx = ((dx >= 0)? 1 : -1) * synaptics_max_speed_x;
	if (abs(dy) > synaptics_max_speed_y)
		dy = ((dy >= 0)? 1 : -1) * synaptics_max_speed_y;
	if (abs(dz) > synaptics_max_speed_z)
		dz = ((dz >= 0)? 1 : -1) * synaptics_max_speed_z;

	if (sp->sp_finger_count > 1) {
		if (abs(sdx) > synaptics_max_speed_x)
			sdx = ((sdx >= 0)? 1 : -1) * synaptics_max_speed_x;
		if (abs(dy) > synaptics_max_speed_y)
			sdy = ((sdy >= 0)? 1 : -1) * synaptics_max_speed_y;
		if (abs(sdz) > synaptics_max_speed_z)
			sdz = ((sdz >= 0)? 1 : -1) * synaptics_max_speed_z;
	}

	*dxp = dx;
	*dyp = dy;
	*dzp = dz;
	*sdxp = sdx;
	*sdyp = sdy;
	*sdzp = sdz;
```

```
		if (abs(dy) > synaptics_max_speed_y)
                    ^^^^^^^
			sdy = ((sdy >= 0)? 1 : -1) * synaptics_max_speed_y;
```

This looks wrong.

>How-To-Repeat:
Code inspection.

>Fix:
Just use abs(sdy) ?

---
Izumi Tsutsui



Home | Main Index | Thread Index | Old Index