public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin/main] libc/stdlib/nano-mallocr.c, typo in variable name
Date: Tue, 29 Aug 2023 12:34:15 +0000 (GMT)	[thread overview]
Message-ID: <20230829123415.EACB7385840F@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=31eb43efa78f8bb67216eec1e7aa0be530360881

commit 31eb43efa78f8bb67216eec1e7aa0be530360881
Author:     Pekka Seppänen <pexu@sourceware.mail.kapsi.fi>
AuthorDate: Mon Aug 28 14:02:20 2023 +0300
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Tue Aug 29 14:33:27 2023 +0200

    libc/stdlib/nano-mallocr.c, typo in variable name
    
    Nano malloc uses `size' in assertation whereas the correct variable would be
    `s'.  Given this has existed ever since nano malloc support was added, based
    on the context ("returned payload area of desired size does not exceed the
    actual allocated chunk") I presume that indeed `s' (user input) and not
    `r->size' (computed) shall be used.

Diff:
---
 newlib/libc/stdlib/nano-mallocr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newlib/libc/stdlib/nano-mallocr.c b/newlib/libc/stdlib/nano-mallocr.c
index a2b50facc35e..41e69abb0bc8 100644
--- a/newlib/libc/stdlib/nano-mallocr.c
+++ b/newlib/libc/stdlib/nano-mallocr.c
@@ -396,7 +396,7 @@ void * nano_malloc(RARG malloc_size_t s)
         *(long *)((char *)r + offset) = -offset;
     }
 
-    assert(align_ptr + size <= (char *)r + alloc_size);
+    assert(align_ptr + s <= (char *)r + alloc_size);
     return align_ptr;
 }
 #endif /* DEFINE_MALLOC */

                 reply	other threads:[~2023-08-29 12:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230829123415.EACB7385840F@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=newlib-cvs@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).