From: Arnd Bergmann <arnd@arndb.de>
To: David Miller <davem@davemloft.net>
Cc: airlied@linux.ie, benh@kernel.crashing.org,
dri-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm: Only use DRM_IOCTL_UPDATE_DRAW compat wrapper for compat X86.
Date: Thu, 19 Feb 2009 15:19:01 +0100 [thread overview]
Message-ID: <200902191519.03399.arnd@arndb.de> (raw)
In-Reply-To: <20090218.013521.97380943.davem@davemloft.net>
On Wednesday 18 February 2009, David Miller wrote:
> drm: Only use DRM_IOCTL_UPDATE_DRAW compat wrapper for compat X86.
>
> Only X86 32-bit uses a different alignment for "unsigned long long"
> than it's 64-bit counterpart.
>
> Therefore this compat translation is only correct, and only needed,
> when either CONFIG_X86 or CONFIG_IA64.
>
> Signed-off-by: David S. Miller <davem@davemloft.net>
The patch is correct AFAICT, but I'd like to point out that the
problem could have been avoided (besides using a non-padded layout)
by using a compat_u64 member in the struct definition instead of
the packed attribute:
typedef struct drm_update_draw32 {
drm_drawable_t handle;
unsigned int type;
unsigned int num;
compat_u64 data; /**< Pointer */
} drm_update_draw32_t;
I find that too often __attribute__((packed)) is used on whole
structures where some other much more gentle solution can be
applied. In fact, there are very few files (e.g.
linux/unaligned/packed_struct.h) that look like they want all
of the implied meanings (pack members, drop alignment on whole
structure, access members as unaligned).
A grep for "packed" in compat_ioctl definitions revealed the
same bug as in drm_update_draw32 to be present in
raw32_config_request, and I'm rather sure that there are more
of these.
Arnd <><
next prev parent reply other threads:[~2009-02-19 14:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-18 9:35 [PATCH] drm: Only use DRM_IOCTL_UPDATE_DRAW compat wrapper for compat X86 David Miller
2009-02-18 21:59 ` Benjamin Herrenschmidt
2009-02-18 22:05 ` David Miller
2009-02-19 14:19 ` Arnd Bergmann [this message]
2009-02-20 8:52 ` David Miller
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=200902191519.03399.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=airlied@linux.ie \
--cc=benh@kernel.crashing.org \
--cc=davem@davemloft.net \
--cc=dri-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.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