From: Andreas Schwab <schwab@linux-m68k.org>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: Florian Weimer <fw@deneb.enyo.de>,
Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org>
Subject: Re: [PATCH] linux: mips: Fix getdents64 fallback on mips64-n32
Date: Tue, 17 Nov 2020 14:38:27 +0100 [thread overview]
Message-ID: <87y2j0yugc.fsf@igel.home> (raw)
In-Reply-To: <08cc387e-e0ec-7242-fdc6-a9b163331986@linaro.org> (Adhemerval Zanella's message of "Tue, 17 Nov 2020 10:19:09 -0300")
On Nov 17 2020, Adhemerval Zanella wrote:
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/getdents64.c b/sysdeps/unix/sysv/linux/mips/mips64/getdents64.c
> index d18a5297dc..368128244e 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/getdents64.c
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/getdents64.c
> @@ -90,17 +90,14 @@ __getdents64 (int fd, void *buf, size_t nbytes)
>
> while ((char *) kdp < (char *) skdp + r)
> {
> - /* This macro is used to avoid aliasing violation. */
> -#define KDP_MEMBER(src, member) \
> - (__typeof__((struct kernel_dirent){0}.member) *) \
> - memcpy (&((__typeof__((struct kernel_dirent){0}.member)){0}), \
> - ((char *)(src) + offsetof (struct kernel_dirent, member)),\
> - sizeof ((struct kernel_dirent){0}.member))
> -
> /* This is a conservative approximation, since some of size_diff might
> fit into the existing padding for alignment. */
> - unsigned short int k_reclen = *KDP_MEMBER (kdp, d_reclen);
> - unsigned short int new_reclen = ALIGN_UP (k_reclen + size_diff,
> +
> + /* Obtain the d_ino, d_off, and d_reclen from kernel filled buffer. */
> + struct kernel_dirent kdirent;
> + memcpy (&kdirent, kdp, sizeof (struct kernel_dirent));
How good is the compiler at eliding the memcpy? What would change if
kdp would just be void *?
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
next prev parent reply other threads:[~2020-11-17 13:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-16 21:17 Adhemerval Zanella
2020-11-16 21:22 ` Florian Weimer
2020-11-17 13:19 ` Adhemerval Zanella
2020-11-17 13:38 ` Andreas Schwab [this message]
2020-11-17 17:37 ` Adhemerval Zanella
2020-11-17 17:51 ` Florian Weimer
2020-11-17 18:08 ` Adhemerval Zanella
2021-01-22 12:49 ` Florian Weimer
2021-01-22 14:20 ` Adhemerval Zanella
2021-01-22 16:02 ` Florian Weimer
2020-11-16 21:40 ` Andreas Schwab
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=87y2j0yugc.fsf@igel.home \
--to=schwab@linux-m68k.org \
--cc=adhemerval.zanella@linaro.org \
--cc=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).