From: Corinna Vinschen <vinschen@redhat.com>
To: newlib@sourceware.org
Subject: Re: [PATCH] Fix _REENT_EMERGENCY() if TLS is enabled
Date: Wed, 26 Apr 2023 09:57:07 +0200 [thread overview]
Message-ID: <ZEjZUwln3VdDQGnN@calimero.vinschen.de> (raw)
In-Reply-To: <20230426062602.121012-1-sebastian.huber@embedded-brains.de>
On Apr 26 08:26, Sebastian Huber wrote:
> If the thread-local storage (TLS) support was enabled, the _REENT_EMERGENCY()
> object had the wrong size. It must be a buffer of length _REENT_EMERGENCY_SIZE
> and not just a single character.
> ---
> newlib/libc/include/sys/reent.h | 2 +-
> newlib/libc/stdio/tmpnam.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h
> index 6d8b005b2b..c71f75dbc2 100644
> --- a/newlib/libc/include/sys/reent.h
> +++ b/newlib/libc/include/sys/reent.h
> @@ -812,7 +812,7 @@ extern _Thread_local int _tls_cvtlen;
> #define _REENT_CVTLEN(_ptr) (_tls_cvtlen)
> extern _Thread_local void (*_tls_cleanup)(struct _reent *);
> #define _REENT_CLEANUP(_ptr) (_tls_cleanup)
> -extern _Thread_local char _tls_emergency;
> +extern _Thread_local char _tls_emergency[_REENT_EMERGENCY_SIZE];
> #define _REENT_EMERGENCY(_ptr) (_tls_emergency)
> extern _Thread_local int _tls_errno;
> #define _REENT_ERRNO(_ptr) (_tls_errno)
> diff --git a/newlib/libc/stdio/tmpnam.c b/newlib/libc/stdio/tmpnam.c
> index 51dfd1cea6..dc04cf3f6c 100644
> --- a/newlib/libc/stdio/tmpnam.c
> +++ b/newlib/libc/stdio/tmpnam.c
> @@ -84,7 +84,7 @@ The global pointer <<environ>> is also required.
>
> #ifdef _REENT_THREAD_LOCAL
> _Thread_local int _tls_inc;
> -_Thread_local char _tls_emergency;
> +_Thread_local char _tls_emergency[_REENT_EMERGENCY_SIZE];
> #endif
>
> /* Try to open the file specified, if it can't be opened then try
> --
> 2.35.3
LGTM
Thanks,
Corinna
prev parent reply other threads:[~2023-04-26 7:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-26 6:26 Sebastian Huber
2023-04-26 7:57 ` Corinna Vinschen [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=ZEjZUwln3VdDQGnN@calimero.vinschen.de \
--to=vinschen@redhat.com \
--cc=newlib@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).