netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: net: core: skbuff.c: Added do-while pair for complex macros
@ 2015-11-26 16:36 Jitendra Kumar Khasdev
  2015-11-26 17:00 ` Joe Perches
  2015-11-26 21:43 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Jitendra Kumar Khasdev @ 2015-11-26 16:36 UTC (permalink / raw)
  To: davem, edumazet, alexander.h.duyck, linus.luessing, hannes,
	willemb
  Cc: netdev, linux-kernel, Jitendra Kumar Khasdev,
	Jitendra Kumar Khasdev

This patch is to file skbuff.c that fixes up following error,
reported by checkpatch.pl tool,

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

Signed-off-by: Jitendra Kumar Khasdev <jkhasdev@gmail.com>
---
 net/core/skbuff.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index aa41e6d..4d31228 100644
--- 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)							\
 
 static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
 {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: net: core: skbuff.c: Added do-while pair for complex macros
  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
  2015-11-26 21:43 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Perches @ 2015-11-26 17:00 UTC (permalink / raw)
  To: Jitendra Kumar Khasdev, davem, edumazet, alexander.h.duyck,
	linus.luessing, hannes, willemb
  Cc: netdev, linux-kernel, Jitendra Kumar Khasdev

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));

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: net: core: skbuff.c: Added do-while pair for complex macros
  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
@ 2015-11-26 21:43 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-11-26 21:43 UTC (permalink / raw)
  To: jkhasdev
  Cc: edumazet, alexander.h.duyck, linus.luessing, hannes, willemb,
	netdev, linux-kernel, jitendra.khasdev

From: Jitendra Kumar Khasdev <jkhasdev@gmail.com>
Date: Thu, 26 Nov 2015 22:06:03 +0530

> This patch is to file skbuff.c that fixes up following error,
> reported by checkpatch.pl tool,
> 
> 1. ERROR: Macros with multiple statements should be enclosed
>    in a do - while loop.
> 
> Signed-off-by: Jitendra Kumar Khasdev <jkhasdev@gmail.com>

It is absolutely not appropriate to submit this to the -staging tree.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-11-26 21:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2015-11-26 21:43 ` David Miller

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).