From: Masami Ichikawa <masami256@gmail.com>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: linux-input@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
Benjamin Tissoires <bentiss@kernel.org>,
Jiri Kosina <jikos@kernel.org>,
Minjong Kim <minbell.kim@samsung.com>
Subject: Re: [PATCH] HID: hid-ntrig: Fix potential memory leak in ntrig_report_version()
Date: Thu, 18 Sep 2025 10:46:32 +0900 [thread overview]
Message-ID: <CACOXgS-VN6CDZE2NMtM0TuoRT1UZD1LR0JbY5XOQ6vsVmsTUKw@mail.gmail.com> (raw)
In-Reply-To: <34b16512-b098-470a-afff-bc8321e2499a@web.de>
Thank you for the review.
On Wed, Sep 17, 2025 at 4:46 PM Markus Elfring <Markus.Elfring@web.de> wrote:
>
> …
> > It is safe to move the kmalloc() call after the hid_is_usb() check to avoid
> > unnecessary allocation and potential memory leak.
>
> * See also:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.17-rc6#n94
>
> * How do you think about to increase the application of scope-based resource management?
> https://elixir.bootlin.com/linux/v6.17-rc6/source/include/linux/slab.h#L476
>
I think using the DEFINE_FREE macro simplifies cleanup, especially
when an error occurs.
> * Can a summary phrase like “Prevent memory leak in ntrig_report_version()”
> be nicer?
>
I see. I will rewrite commit log.
>
> Regards,
> Markus
Regards,
--
Masami Ichikawa
prev parent reply other threads:[~2025-09-18 1:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-17 4:50 [PATCH] HID: hid-ntrig: Fix potential memory leak in ntrig_report_version() Masami Ichikawa
2025-09-17 7:46 ` Markus Elfring
2025-09-18 1:46 ` Masami Ichikawa [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=CACOXgS-VN6CDZE2NMtM0TuoRT1UZD1LR0JbY5XOQ6vsVmsTUKw@mail.gmail.com \
--to=masami256@gmail.com \
--cc=Markus.Elfring@web.de \
--cc=bentiss@kernel.org \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=minbell.kim@samsung.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;
as well as URLs for NNTP newsgroup(s).