public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Joe Simmons-Talbott <josimmon@redhat.com>
To: libc-alpha@sourceware.org
Subject: Re: [PATCH v2] hurd: readv: Get rid of alloca
Date: Mon, 19 Jun 2023 10:24:11 -0400	[thread overview]
Message-ID: <20230619142411.GG6392@oak> (raw)
In-Reply-To: <20230619141325.2324846-1-josimmon@redhat.com>

On Mon, Jun 19, 2023 at 10:13:25AM -0400, Joe Simmons-Talbott wrote:
> Replace alloca with a scratch_buffer to avoid potential stack overflows.
> 
> Checked on i686-gnu and x86_64-linux-gnu
> ---
> Changes to v1:
>   * Add back the cleanup handler since this is a "shall occur"
>     cancellation point.
> 
>  sysdeps/posix/readv.c | 29 ++++++++++++-----------------
>  1 file changed, 12 insertions(+), 17 deletions(-)
> 
> diff --git a/sysdeps/posix/readv.c b/sysdeps/posix/readv.c
> index 91208e9894..fab35754b0 100644
> --- a/sysdeps/posix/readv.c
> +++ b/sysdeps/posix/readv.c
> @@ -19,16 +19,16 @@
>  #include <unistd.h>
>  #include <string.h>
>  #include <limits.h>
> +#include <scratch_buffer.h>
>  #include <stdbool.h>
>  #include <sys/param.h>
>  #include <sys/uio.h>
>  #include <errno.h>
>  
> -
>  static void
> -ifree (char **ptrp)
> +ifree (struct scratch_buffer *sbuf)
>  {
> -  free (*ptrp);
> +  scratch_buffer_free(sbuf);
>  }

There are a couple of spacing issues here.  I will send a v3 shortly.

Thanks,
Joe


      reply	other threads:[~2023-06-19 14:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-19 14:13 Joe Simmons-Talbott
2023-06-19 14:24 ` Joe Simmons-Talbott [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=20230619142411.GG6392@oak \
    --to=josimmon@redhat.com \
    --cc=libc-alpha@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).