From: =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont <remi@remlab.net>
To: ofono@ofono.org
Subject: Re: netlink.c:97: error: cast increases required alignment of target type
Date: Mon, 09 Nov 2009 20:03:48 +0200 [thread overview]
Message-ID: <200911092003.48173.remi@remlab.net> (raw)
In-Reply-To: <fb249edb0911090957y79b2e29q584db4a849b812b1@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1037 bytes --]
Le lundi 9 novembre 2009 19:57:07 andrzej zaborowski, vous avez écrit :
> 2009/11/9 Rémi Denis-Courmont <remi@remlab.net>:
> > As far as I know NO extra alignement is needed. The kernel will anyway
> > memory copy from/to the sockaddr_pn buffer as part of the socket calls,
> > so it couldn't care less about alignment.
>
> Practically I'm sure you're right and maybe we should stick a (void *)
> cast in between the casts or disable the warning. Formally that
> memcpy is an implementation detail and could be true in one kernel
> version and false in the next version, so when you pass a struct
> sockaddr * to a function it should, in theory be aligned as such.
Well no. The only thing you're allowed to read from someone else's sockaddr is
the family field, which does have the same alignment in sockaddr_pn as in
sockaddr (practically, two bytes). After that, the reader is responsible for
casting back to the correct type.
So this warning is _bogus_.
--
Rémi Denis-Courmont
http://www.remlab.net/
next prev parent reply other threads:[~2009-11-09 18:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-09 15:45 netlink.c:97: error: cast increases required alignment of target type andrzej zaborowski
2009-11-09 17:27 ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2009-11-09 17:34 ` andrzej zaborowski
2009-11-09 17:45 ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2009-11-09 17:57 ` andrzej zaborowski
2009-11-09 18:03 ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont [this message]
-- strict thread matches above, loose matches on Subject: below --
2009-09-15 18:36 Timo Juhani Lindfors
2009-09-16 14:00 ` Aki Niemi
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=200911092003.48173.remi@remlab.net \
--to=remi@remlab.net \
--cc=ofono@ofono.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.