diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-10-16 11:53:20 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-10-16 11:53:20 -0700 |
commit | 72323bf07cc74fb03e63898b14136ae30a770580 (patch) | |
tree | 170d82ef0fb5de8c7e2ccdec58c04290b3e530dc | |
parent | f62f35747ec65e7f8819fab2c928db1b1b4c56eb (diff) | |
download | xorg-driver-xf86-input-mouse-72323bf07cc74fb03e63898b14136ae30a770580.tar.gz |
sun_mouse: Fix -Wnull-dereference warning
sun_mouse.c: In function ‘vuidReadInput’:
sun_mouse.c:291:10: warning: potential null pointer dereference [-Wnull-dereference]
pBuf = pVuidMse->buffer;
~~~~~^~~~~~~~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | src/sun_mouse.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/sun_mouse.c b/src/sun_mouse.c index 8328c46..3b362c5 100644 --- a/src/sun_mouse.c +++ b/src/sun_mouse.c @@ -286,10 +286,13 @@ vuidReadInput(InputInfoPtr pInfo) Bool absXset = FALSE, absYset = FALSE; pMse = pInfo->private; - pVuidMse = getVuidMsePriv(pInfo); buttons = pMse->lastButtons; + pVuidMse = getVuidMsePriv(pInfo); + if (pVuidMse == NULL) { + xf86Msg(X_ERROR, "%s: cannot locate VuidMsePtr\n", pInfo->name); + return; + } pBuf = pVuidMse->buffer; - n = 0; do { n = read(pInfo->fd, pBuf, sizeof(Firm_event)); |