From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: lihongtao <lihongtao@kylinos.cn>
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v2] tools/bootconfig: Fix buf leaks in apply_xbc
Date: Thu, 21 May 2026 11:38:27 +0900 [thread overview]
Message-ID: <20260521113827.abef811ba8ab312d5bc85b65@kernel.org> (raw)
In-Reply-To: <20260520030126.147782-1-lihongtao@kylinos.cn>
On Wed, 20 May 2026 11:01:26 +0800
lihongtao <lihongtao@kylinos.cn> wrote:
> From: Hongtao Lee <lihongtao@kylinos.cn>
>
> If data calloc failed, free the buf before return.
>
Thanks! Let me pick it.
> Fixes: 950313ebf79c ("tools: bootconfig: Add bootconfig command")
> Signed-off-by: Hongtao Lee <lihongtao@kylinos.cn>
> ---
> V1 -> V2: Change Email Signed name
> tools/bootconfig/main.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c
> index 643f707b8f1d..ddabde20585f 100644
> --- a/tools/bootconfig/main.c
> +++ b/tools/bootconfig/main.c
> @@ -390,8 +390,10 @@ static int apply_xbc(const char *path, const char *xbc_path)
>
> /* Backup the bootconfig data */
> data = calloc(size + BOOTCONFIG_ALIGN + BOOTCONFIG_FOOTER_SIZE, 1);
> - if (!data)
> + if (!data) {
> + free(buf);
> return -ENOMEM;
> + }
> memcpy(data, buf, size);
>
> /* Check the data format */
> --
> 2.25.1
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
prev parent reply other threads:[~2026-05-21 2:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-20 3:01 [PATCH v2] tools/bootconfig: Fix buf leaks in apply_xbc lihongtao
2026-05-21 2:38 ` Masami Hiramatsu [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=20260521113827.abef811ba8ab312d5bc85b65@kernel.org \
--to=mhiramat@kernel.org \
--cc=lihongtao@kylinos.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-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