Input: psmouse - fix psmouse detect function is a NULL pointer
Subsystems (2)
PATCH 1/1 Input: psmouse - fix psmouse detect function is a NULL pointer
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 <[email protected]>
--- drivers/input/mouse/psmouse-base.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/input/mouse/psmouse-base.c +3 -0
@@ -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 ; }
Signature · 1 line
2.20.1
Dmitry Torokhov
maintainerHi Qiang,
Quoted 13 lines · Qiang Ma
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 <[email protected]>--- drivers/input/mouse/psmouse-base.c | 3 +++ 1 file changed, 3 insertions(+)drivers/input/mouse/psmouse-base.c +0
-0
drivers/input/mouse/psmouse-base.c static bool psmouse_do_detect(int (*detect)(struct psmouse *, bool), · line 1010
Quoted 5 lines
drivers/input/mouse/psmouse-base.c +2
-0@@ -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;
There are no protocols that do not define detect() method, so this condition is not possible.
drivers/input/mouse/psmouse-base.c static bool psmouse_do_detect(int (*detect)(struct psmouse *, bool), · line 1014
Quoted 4 lines
drivers/input/mouse/psmouse-base.c +1
-0+return detect (psmouse, set_properties) ==0 ; }
Thanks.
Signature · 1 line
Dmitry