summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-10-16 11:53:20 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-10-16 11:53:20 -0700
commit72323bf07cc74fb03e63898b14136ae30a770580 (patch)
tree170d82ef0fb5de8c7e2ccdec58c04290b3e530dc
parentf62f35747ec65e7f8819fab2c928db1b1b4c56eb (diff)
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.c7
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));