From: Florian Weimer <fw@deneb.enyo.de>
To: Fangrui Song via Libc-alpha <libc-alpha@sourceware.org>
Subject: Re: [PATCH v2] linux: Fix a non-constant expression in _Static_assert
Date: Fri, 15 Oct 2021 07:12:54 +0200 [thread overview]
Message-ID: <87lf2uyip5.fsf@mid.deneb.enyo.de> (raw)
In-Reply-To: <20211008004643.532196-1-maskray@google.com> (Fangrui Song via Libc-alpha's message of "Thu, 7 Oct 2021 17:46:43 -0700")
* Fangrui Song via Libc-alpha:
> diff --git a/sysdeps/unix/sysv/linux/opendir.c b/sysdeps/unix/sysv/linux/opendir.c
> index 48f254d169..88640f44ee 100644
> --- a/sysdeps/unix/sysv/linux/opendir.c
> +++ b/sysdeps/unix/sysv/linux/opendir.c
> @@ -103,7 +103,7 @@ __alloc_dir (int fd, bool close_fd, int flags,
> file system provides a bogus value. */
> enum { max_buffer_size = 1048576 };
>
> - const size_t allocation_size = 32768;
> + enum { allocation_size = 32768 };
> _Static_assert (allocation_size >= sizeof (struct dirent64),
> "allocation_size < sizeof (struct dirent64)");
Below we have:
/* Increase allocation if requested, but not if the value appears to
be bogus. It will be between 32Kb and 1Mb. */
size_t allocation = MIN (MAX ((size_t) statp->st_blksize, allocation_size),
max_buffer_size);
Mixed-type MAX is a bit iffy, but we already have mixed-type MIN here,
so it probably does not matter.
next prev parent reply other threads:[~2021-10-15 5:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-08 0:46 Fangrui Song
2021-10-15 0:10 ` Fāng-ruì Sòng
2021-10-15 5:12 ` Florian Weimer [this message]
2021-10-19 6:23 ` Fāng-ruì Sòng
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=87lf2uyip5.fsf@mid.deneb.enyo.de \
--to=fw@deneb.enyo.de \
--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).