lkml.org 
[lkml]   [2021]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] Input: psmouse - fix psmouse detect function is a NULL pointer
Date
Add a check for psmouse_do_detect(), when the detect is NULL pointer,
returning false, avoiding this possible NULL pointer exception.

Signed-off-by: Qiang Ma <maqianga@uniontech.com>
---
drivers/input/mouse/psmouse-base.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 0b4a3039f312..86b095728587 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -1006,6 +1006,9 @@ static bool psmouse_do_detect(int (*detect)(struct psmouse *, bool),
if (set_properties)
psmouse_apply_defaults(psmouse);

+ if (!detect)
+ return false;
+
return detect(psmouse, set_properties) == 0;
}

--
2.20.1


\
 
 \ /
  Last update: 2021-05-19 05:28    [W:0.035 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site