public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Charlie Jenkins <charlie@rivosinc.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>, Ron Economos <re@w6rz.net>,
	Samuel Holland <samuel.holland@sifive.com>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] riscv: Safely remove entries from relocation list
Date: Mon, 27 Nov 2023 11:42:08 +0100	[thread overview]
Message-ID: <87bkbfzddr.fsf@igel.home> (raw)
In-Reply-To: <20231122-module_linking_freeing-v3-1-8e9e412a3305@rivosinc.com> (Charlie Jenkins's message of "Wed, 22 Nov 2023 15:31:41 -0800")

On Nov 22 2023, Charlie Jenkins wrote:

> @@ -683,17 +700,29 @@ int add_relocation_to_accumulate(struct module *me, int type, void *location,
>  
>  	if (!found) {
>  		rel_head = kmalloc(sizeof(*rel_head), GFP_KERNEL);
> +
> +		if (!rel_head)
> +			return -ENOMEM;
> +
>  		rel_head->rel_entry =
>  			kmalloc(sizeof(struct list_head), GFP_KERNEL);
> +
> +		if (!rel_head->rel_entry)
> +			return -ENOMEM;

This leaks rel_head on error.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

  reply	other threads:[~2023-11-27 10:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-22 23:31 [PATCH v3 0/2] riscv: Fix issues with module loading Charlie Jenkins
2023-11-22 23:31 ` [PATCH v3 1/2] riscv: Safely remove entries from relocation list Charlie Jenkins
2023-11-27 10:42   ` Andreas Schwab [this message]
2023-12-04 18:42     ` Charlie Jenkins
2023-11-22 23:31 ` [PATCH v3 2/2] riscv: Correct type casting in module loading Charlie Jenkins

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=87bkbfzddr.fsf@igel.home \
    --to=schwab@linux-m68k.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=charlie@rivosinc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=re@w6rz.net \
    --cc=samuel.holland@sifive.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