netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Graf <tgraf@suug.ch>
To: Hong Zhiguo <honkiko@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
	stephen@networkplumber.org, brian.haley@hp.com
Subject: Re: [PATCH] netlink: fix the warning introduced by netlink API replacement
Date: Fri, 29 Mar 2013 13:58:27 +0000	[thread overview]
Message-ID: <20130329135827.GM23043@casper.infradead.org> (raw)
In-Reply-To: <1364563360-3516-1-git-send-email-honkiko@gmail.com>

On 03/29/13 at 09:22pm, Hong Zhiguo wrote:
> Signed-off-by: Hong Zhiguo <honkiko@gmail.com>
> ---
>  net/ieee802154/netlink.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ieee802154/netlink.c b/net/ieee802154/netlink.c
> index 9247252..91b0363 100644
> --- a/net/ieee802154/netlink.c
> +++ b/net/ieee802154/netlink.c
> @@ -65,7 +65,8 @@ struct sk_buff *ieee802154_nl_create(int flags, u8 req)
>  int ieee802154_nl_mcast(struct sk_buff *msg, unsigned int group)
>  {
>  	/* XXX: nlh is right at the start of msg */
> -	void *hdr = genlmsg_data(nlmsg_data(msg->data));
> +	struct nlmsghdr *nlh = (struct nlmsghdr *)msg->data;
> +	void *hdr = genlmsg_data(nlmsg_data(nlh));

You should be using nlmsg_hdr() which would also allow to drop
the 'XXX' comment.

Obviously this was a partial API abuse that lead to these warnings
and the whole point of converting is to trigger such warnings instead
of silently accept msitakes, but it would have been great to catch
this in the first place by compiling with allmodconfig + some random
configs.

  reply	other threads:[~2013-03-29 13:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-27 16:47 [PATCH 1/6] net-next: replace obsolete NLMSG_* with type safe nlmsg_* Hong Zhiguo
2013-03-28 14:32 ` Thomas Graf
2013-03-28 16:08   ` Hong zhi guo
2013-03-28 18:01     ` Thomas Graf
2013-03-28 18:00   ` David Miller
2013-03-28 18:28 ` David Miller
2013-03-29  2:57 ` Brian Haley
2013-03-29 13:22 ` [PATCH] netlink: fix the warning introduced by netlink API replacement Hong Zhiguo
2013-03-29 13:58   ` Thomas Graf [this message]
2013-03-29 15:09 ` [PATCH v2 net-next] " Hong Zhiguo
2013-03-29 18:45   ` 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=20130329135827.GM23043@casper.infradead.org \
    --to=tgraf@suug.ch \
    --cc=brian.haley@hp.com \
    --cc=davem@davemloft.net \
    --cc=honkiko@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.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).