public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Willy Tarreau <w@1wt.eu>
To: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Cc: "Brennan Xavier McManus" <bxmcmanus@gmail.com>,
	"Thomas Weißschuh" <linux@weissschuh.net>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tools/nolibc/stdlib: fix memory error in realloc()
Date: Wed, 10 Jan 2024 07:17:52 +0100	[thread overview]
Message-ID: <ZZ42kAxNA0ogdMAF@1wt.eu> (raw)
In-Reply-To: <ZZ4Y+dak5LC6LTg7@biznet-home.integral.gnuweeb.org>

Hi,

On Wed, Jan 10, 2024 at 11:11:37AM +0700, Ammar Faizi wrote:
> On Tue, Jan 09, 2024 at 06:44:02PM -0500, Brennan Xavier McManus wrote:
> > Pass user_p_len to memcpy() instead of heap->len to prevent realloc()
> > from copying an extra sizeof(heap) bytes from beyond the allocated
> > region.
> > 
> > Signed-off-by: Brennan Xavier McManus <bxmcmanus@gmail.com>
> > ---
> > 
> > All tests from Ammar's original test program pass:
> > https://gist.github.com/ammarfaizi2/db0af6aa0b95a0c7478bce64e349f021
> > This fix was tested with the following added test for realloc():
> > https://github.com/brennan913/nolibc-test/blob/main/nolibc_test.c#L73-L120
> 
> Hello Brennan,
> 
> Thank you for the fix!
> 
> Cc: stable@vger.kernel.org
> Reviewed-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
> Fixes: 0e0ff638400be8f497a35b51a4751fd823f6bd6a ("tools/nolibc/stdlib: Implement `malloc()`, `calloc()`, `realloc()` and `free()`")

Thanks both for the fix and the review! I've pushed it to the "fixes"
branch. Thomas, for now I updated the branch to match "next" (which just
got merged) so as to preserve patch ordering, we'll just rebase it once
6.8-rc1 is out.

Willy

      reply	other threads:[~2024-01-10  6:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-09 23:44 [PATCH] tools/nolibc/stdlib: fix memory error in realloc() Brennan Xavier McManus
2024-01-10  4:11 ` Ammar Faizi
2024-01-10  6:17   ` Willy Tarreau [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=ZZ42kAxNA0ogdMAF@1wt.eu \
    --to=w@1wt.eu \
    --cc=ammarfaizi2@gnuweeb.org \
    --cc=bxmcmanus@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    /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