Linux-EDAC Archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Yazen Ghannam <yazen.ghannam@amd.com>,
	Tony Luck <tony.luck@intel.com>,
	naveenkrishna.chatradhi@amd.com, muralidhara.mk@amd.com,
	linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] RAS/AMD/FMPM: Fix off by one in error handling
Date: Wed, 6 Mar 2024 10:29:38 +0100	[thread overview]
Message-ID: <20240306092938.GAZeg3grpW-PMOqFz9@fat_crate.local> (raw)
In-Reply-To: <6fdec71a-846b-4cd0-af69-e5f6cd12f4f6@moroto.mountain>

On Wed, Mar 06, 2024 at 08:30:46AM +0300, Dan Carpenter wrote:
> Decrement "i" before the first iteration.  Depending on where this fails
> it could free something from one element beyond the end of the
> fru_records[] array.
> 
> Fixes: 6f15e617cc99 ("RAS: Introduce a FRU memory poison manager")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  drivers/ras/amd/fmpm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ras/amd/fmpm.c b/drivers/ras/amd/fmpm.c
> index 0963c9e7b853..2f4ac9591c8f 100644
> --- a/drivers/ras/amd/fmpm.c
> +++ b/drivers/ras/amd/fmpm.c
> @@ -817,7 +817,7 @@ static int allocate_records(void)
>  	return ret;
>  
>  out_free:
> -	for (; i >= 0; i--)
> +	while (--i >= 0)
>  		kfree(fru_records[i]);
>  
>  	kfree(fru_records);
> -- 

Applied, thanks.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

      reply	other threads:[~2024-03-06  9:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-06  5:30 [PATCH] RAS/AMD/FMPM: Fix off by one in error handling Dan Carpenter
2024-03-06  9:29 ` Borislav Petkov [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=20240306092938.GAZeg3grpW-PMOqFz9@fat_crate.local \
    --to=bp@alien8.de \
    --cc=dan.carpenter@linaro.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=muralidhara.mk@amd.com \
    --cc=naveenkrishna.chatradhi@amd.com \
    --cc=tony.luck@intel.com \
    --cc=yazen.ghannam@amd.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 read-only IMAP folder(s) and NNTP newsgroup(s).