netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Jitendra Kumar Khasdev <jkhasdev@gmail.com>,
	davem@davemloft.net, edumazet@google.com,
	alexander.h.duyck@redhat.com, linus.luessing@c0d3.bluen,
	hannes@stressinduktion.org, willemb@google.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jitendra Kumar Khasdev <jitendra.khasdev@hotwaxsystems.com>
Subject: Re: [PATCH] staging: net: core: skbuff.c: Added do-while pair for complex macros
Date: Thu, 26 Nov 2015 09:00:23 -0800	[thread overview]
Message-ID: <1448557223.18647.4.camel@perches.com> (raw)
In-Reply-To: <1448555763-5088-1-git-send-email-jitendra.khasdev@hotwaxsystems.com>

On Thu, 2015-11-26 at 22:06 +0530, Jitendra Kumar Khasdev wrote:
> This patch is to file skbuff.c that fixes up following error,
> reported by checkpatch.pl tool,

Your subject title is not correct.
This is not a staging patch.

> 1. ERROR: Macros with multiple statements should be enclosed
>    in a do - while loop.

checkpatch is brainless.
Not every message it emits needs fixing.


> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
[]
> @@ -748,11 +748,13 @@ void consume_skb(struct sk_buff *skb)
>  EXPORT_SYMBOL(consume_skb);
>  
>  /* Make sure a field is enclosed inside headers_start/headers_end section */
> -#define CHECK_SKB_FIELD(field) \
> -	BUILD_BUG_ON(offsetof(struct sk_buff, field) <		\
> -		     offsetof(struct sk_buff, headers_start));	\
> -	BUILD_BUG_ON(offsetof(struct sk_buff, field) >		\
> -		     offsetof(struct sk_buff, headers_end));	\
> +#define CHECK_SKB_FIELD(field)						\
> +	do {								\
> +		BUILD_BUG_ON(offsetof(struct sk_buff, field) <		\
> +			offsetof(struct sk_buff, headers_start));	\
> +		BUILD_BUG_ON(offsetof(struct sk_buff, field) >		\
> +			offsetof(struct sk_buff, headers_end));		\
> +	} while (0)							\

Perhaps the last check should add a sizeof(field)

	BUILD_BUG_ON((offsetof(struct sk_buff, field) +
		      FIELD_SIZEOF(struct sk_buff, field)) >
		     offsetof(struct sk_buff, headers_end));

  reply	other threads:[~2015-11-26 17:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-26 16:36 [PATCH] staging: net: core: skbuff.c: Added do-while pair for complex macros Jitendra Kumar Khasdev
2015-11-26 17:00 ` Joe Perches [this message]
2015-11-26 21:43 ` 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=1448557223.18647.4.camel@perches.com \
    --to=joe@perches.com \
    --cc=alexander.h.duyck@redhat.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hannes@stressinduktion.org \
    --cc=jitendra.khasdev@hotwaxsystems.com \
    --cc=jkhasdev@gmail.com \
    --cc=linus.luessing@c0d3.bluen \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=willemb@google.com \
    /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).