mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Silvan Jegen" <s.jegen@gmail.com>
To: Jia-Ju Bai <baijiaju1990@gmail.com>
Cc: djogorchock@gmail.com, jikos@kernel.org,
	benjamin.tissoires@redhat.com, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hid: hid-nintendo: check the return value of alloc_workqueue()
Date: Sat, 26 Feb 2022 15:14:14 +0100	[thread overview]
Message-ID: <1ZE3UIEB0O2B6.2GHX7WO8NQZUJ@homearch.localdomain> (raw)
In-Reply-To: <20220225034110.13341-1-baijiaju1990@gmail.com>

Hi

Jia-Ju Bai <baijiaju1990@gmail.com> wrote:
> The function alloc_workqueue() in nintendo_hid_probe() can fail, but
> there is no check of its return value. To fix this bug, its return value
> should be checked with new error handling code.
> 
> Fixes: c4eae84feff3e ("HID: nintendo: add rumble support")
> Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
> ---
>  drivers/hid/hid-nintendo.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c
> index b6a9a0f3966e..2204de889739 100644
> --- a/drivers/hid/hid-nintendo.c
> +++ b/drivers/hid/hid-nintendo.c
> @@ -2128,6 +2128,10 @@ static int nintendo_hid_probe(struct hid_device *hdev,
>  	spin_lock_init(&ctlr->lock);
>  	ctlr->rumble_queue = alloc_workqueue("hid-nintendo-rumble_wq",
>  					     WQ_FREEZABLE | WQ_MEM_RECLAIM, 0);
> +	if (!ctlr->rumble_queue) {
> +		ret = -ENOMEM;
> +		goto err;
> +	}
>  	INIT_WORK(&ctlr->rumble_worker, joycon_rumble_worker);
>  
>  	ret = hid_parse(hdev);

LGTM!

Reviewed-by: Silvan Jegen <s.jegen@gmail.com>


Cheers,

Silvan

  reply	other threads:[~2022-02-26 14:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-25  3:41 Jia-Ju Bai
2022-02-26 14:14 ` Silvan Jegen [this message]
2022-03-01 14:58 ` Jiri Kosina

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=1ZE3UIEB0O2B6.2GHX7WO8NQZUJ@homearch.localdomain \
    --to=s.jegen@gmail.com \
    --cc=baijiaju1990@gmail.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=djogorchock@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®