mirror of
https://github.com/X11Libre/xf86-input-mouse.git
synced 2026-04-14 10:54:18 +00:00
mouse.c: handle -Wanalyzer-null-dereference in createProtoList
Should never happen, but the compiler would need to understand the flow
of our state machine to realize that, and this protects us if that ever
changes.
Clears warning from gcc 14.2.0:
mouse.c: In function ‘createProtoList’:
mouse.c:3226:30: warning: dereference of NULL ‘protoList’ [CWE-476]
[-Wanalyzer-null-dereference]
3226 | for (i = 0; protoList[i] != PROT_UNKNOWN; i++) {
| ~~~~~~~~~^~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-mouse/-/merge_requests/23>
This commit is contained in:
@@ -3215,6 +3215,11 @@ createProtoList(MouseDevPtr pMse, MouseProtocolID *protoList)
|
||||
AP_DBGC(("%2.2x ", (unsigned char) mPriv->data[i]));
|
||||
AP_DBGC(("\n"));
|
||||
|
||||
if (protoList == NULL) {
|
||||
AP_DBG(("Skipping probe, protoList is NULL"));
|
||||
return;
|
||||
}
|
||||
|
||||
#if HAVE_THREADED_INPUT
|
||||
input_lock();
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user