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:
Alan Coopersmith
2025-04-21 14:30:36 -07:00
parent f3e246a7fb
commit f15c5702f8

View File

@@ -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