From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Qiang Ma <maqianga@uniontech.com>
Cc: wangxiongfeng2@huawei.com, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Input: psmouse - fix psmouse detect function is a NULL pointer
Date: Tue, 1 Jun 2021 22:13:46 -0700 [thread overview]
Message-ID: <YLcTilSGgW6jMKEy@google.com> (raw)
In-Reply-To: <20210519032335.19326-1-maqianga@uniontech.com>
Hi Qiang,
On Wed, May 19, 2021 at 11:23:35AM +0800, Qiang Ma wrote:
> 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;
There are no protocols that do not define detect() method, so this
condition is not possible.
> +
> return detect(psmouse, set_properties) == 0;
> }
>
Thanks.
--
Dmitry
prev parent reply other threads:[~2021-06-02 5:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-19 3:23 [PATCH] Input: psmouse - fix psmouse detect function is a NULL pointer Qiang Ma
2021-06-02 5:13 ` Dmitry Torokhov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YLcTilSGgW6jMKEy@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maqianga@uniontech.com \
--cc=wangxiongfeng2@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox