netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: hugh@mimosa.com
Cc: netdev@vger.kernel.org
Subject: Re: PATCH: netdev: add a cast NLMSG_OK to avoid a GCC warning in users' code
Date: Wed, 09 Sep 2015 14:02:15 -0700 (PDT)	[thread overview]
Message-ID: <20150909.140215.1213898124238701461.davem@davemloft.net> (raw)
In-Reply-To: <alpine.LRH.2.02.1509091555230.4754@redclaw.mimosa.com>

From: "D. Hugh Redelmeier" <hugh@mimosa.com>
Date: Wed, 9 Sep 2015 16:24:07 -0400 (EDT)

> | From: David Miller <davem@davemloft.net>
> 
> | From: "D. Hugh Redelmeier" <hugh@mimosa.com>
> | Date: Tue, 8 Sep 2015 09:46:56 -0400 (EDT)
> | 
> | > Using netlink.h's NLMSG_OK correctly will cause GCC to issue a warning
> | > on systems with 32-bit userland.  The definition can easily be changed
> | > to avoid this.
> | 
> | Everyone either uses an unsigned type (such as "size_t") or adds an
> | explicit cast to an unsinged type for the second argument.
> 
> 1) netlink(3) says that the type of the second parameter is "int".
>    From the synopsis:
>        int NLMSG_OK(struct nlmsghdr *nlh, int len);
>    Surely then "int" should be appropriate.

Documentation can, and often is, wrong.  The code that has been there
for more than two decades determines what the interface and semantics
actually are.

Whatever is actually in the macro is what people have to accomodate
and cope with.

  reply	other threads:[~2015-09-09 21:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-08 13:46 PATCH: netdev: add a cast NLMSG_OK to avoid a GCC warning in users' code D. Hugh Redelmeier
2015-09-09 19:37 ` David Miller
2015-09-09 20:24   ` D. Hugh Redelmeier
2015-09-09 21:02     ` David Miller [this message]
2015-09-11  6:34       ` D. Hugh Redelmeier
2015-09-11  8:42     ` David Laight
2015-09-11 17:11       ` D. Hugh Redelmeier
2015-09-11  6:21   ` D. Hugh Redelmeier
2015-09-19 21:43   ` D. Hugh Redelmeier

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=20150909.140215.1213898124238701461.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=hugh@mimosa.com \
    --cc=netdev@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;
as well as URLs for NNTP newsgroup(s).