All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Cc: Jiri Kosina <jikos@kernel.org>,
	"open list:HID CORE LAYER" <linux-input@vger.kernel.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] HID: potential dereference of null pointer
Date: Mon, 20 Dec 2021 15:10:50 +0100	[thread overview]
Message-ID: <CAO-hwJ+VZscrj9yGOkPruuUXXkg4NOPRnj36aa+-+5JvGxGk+w@mail.gmail.com> (raw)
In-Reply-To: <20211215083605.117638-1-jiasheng@iscas.ac.cn>

On Wed, Dec 15, 2021 at 9:36 AM Jiasheng Jiang <jiasheng@iscas.ac.cn> wrote:
>
> The return value of devm_kzalloc() needs to be checked.
> To avoid hdev->dev->driver_data to be null in case of the failure of
> alloc.
>
> Fixes: 14c9c014babe ("HID: add vivaldi HID driver")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---

Thanks for the fix. I have now pushed it to hid.git, branch
for-5.16/upstream-fixes

Cheers,
Benjamin

>  drivers/hid/hid-vivaldi.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/hid/hid-vivaldi.c b/drivers/hid/hid-vivaldi.c
> index cd7ada48b1d9..72957a9f7117 100644
> --- a/drivers/hid/hid-vivaldi.c
> +++ b/drivers/hid/hid-vivaldi.c
> @@ -57,6 +57,9 @@ static int vivaldi_probe(struct hid_device *hdev,
>         int ret;
>
>         drvdata = devm_kzalloc(&hdev->dev, sizeof(*drvdata), GFP_KERNEL);
> +       if (!drvdata)
> +               return -ENOMEM;
> +
>         hid_set_drvdata(hdev, drvdata);
>
>         ret = hid_parse(hdev);
> --
> 2.25.1
>


      reply	other threads:[~2021-12-20 14:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-15  8:36 [PATCH] HID: potential dereference of null pointer Jiasheng Jiang
2021-12-20 14:10 ` Benjamin Tissoires [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=CAO-hwJ+VZscrj9yGOkPruuUXXkg4NOPRnj36aa+-+5JvGxGk+w@mail.gmail.com \
    --to=benjamin.tissoires@redhat.com \
    --cc=jiasheng@iscas.ac.cn \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.