All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Zilin Guan <zilin@seu.edu.cn>
Cc: Hans de Goede <hansg@kernel.org>,
	jianhao.xu@seu.edu.cn,  LKML <linux-kernel@vger.kernel.org>,
	platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH] platform/x86/amd: Fix memory leak in wbrf_record()
Date: Fri, 2 Jan 2026 13:29:20 +0200 (EET)	[thread overview]
Message-ID: <df87cb9d-467b-e9bd-52d6-5ca4f0c1137a@linux.intel.com> (raw)
In-Reply-To: <20251230091725.1140570-1-zilin@seu.edu.cn>

[-- Attachment #1: Type: text/plain, Size: 1227 bytes --]

On Tue, 30 Dec 2025, Zilin Guan wrote:
> On Tue, Dec 30, 2025 at 09:51:06AM+0100, Markus Elfring wrote:
> > …
> > > Fix this by adding a free_tmp label and jumping to it when obj is NULL,
> > > ensuring tmp is properly freed.
> > 
> > How do you think about to increase the application of scope-based 
> > resource management? 
> > 
> > Regards,
> > Markus
> 
> Thanks for the suggestion.
> 
> While scope-based resource management is a valid improvement, I prefer to 
> keep this patch focused solely on fixing the memory leak using the 
> existing coding style of the file. This ensures the fix is minimal and 
> easier to backport.
> 
> Such refactoring is arguably outside the scope of this fix.

Hi,

Lets not get too attached to the ways of the past, using __free() is
what we want to use even as a fix here. Adding goto labels adds 
complexity, not reduces it, so I don't buy the easier backport argument
(on backport each goto target should be carefully reviewed which is 
something __free() does not require because it simply is better 
interface).

You just need to remember to move also the variable declaration down to 
the alloc site as per the guidance in cleanup.h.

-- 
 i.

  reply	other threads:[~2026-01-02 11:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-30  6:43 [PATCH] platform/x86/amd: Fix memory leak in wbrf_record() Zilin Guan
2025-12-30  8:51 ` Markus Elfring
2025-12-30  9:17 ` Zilin Guan
2026-01-02 11:29   ` Ilpo Järvinen [this message]
2026-01-03 12:17     ` Zilin Guan

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=df87cb9d-467b-e9bd-52d6-5ca4f0c1137a@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=hansg@kernel.org \
    --cc=jianhao.xu@seu.edu.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=zilin@seu.edu.cn \
    /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.