Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1278336 > unrolled thread

[PATCH] staging: net: core: skbuff.c: Added do-while pair for complex macros

Started byJitendra Kumar Khasdev <jkhasdev@gmail.com>
First post2015-11-26 17:40 +0100
Last post2015-11-26 22:50 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] staging: net: core: skbuff.c: Added do-while pair for complex macros Jitendra Kumar Khasdev <jkhasdev@gmail.com> - 2015-11-26 17:40 +0100
    Re: [PATCH] staging: net: core: skbuff.c: Added do-while pair for  complex macros Joe Perches <joe@perches.com> - 2015-11-26 18:10 +0100
    Re: [PATCH] staging: net: core: skbuff.c: Added do-while pair for  complex macros David Miller <davem@davemloft.net> - 2015-11-26 22:50 +0100

#1278336 — [PATCH] staging: net: core: skbuff.c: Added do-while pair for complex macros

FromJitendra Kumar Khasdev <jkhasdev@gmail.com>
Date2015-11-26 17:40 +0100
Subject[PATCH] staging: net: core: skbuff.c: Added do-while pair for complex macros
Message-ID<qz7Kq-7Fr-25@gated-at.bofh.it>
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1278351 — Re: [PATCH] staging: net: core: skbuff.c: Added do-while pair for complex macros

FromJoe Perches <joe@perches.com>
Date2015-11-26 18:10 +0100
SubjectRe: [PATCH] staging: net: core: skbuff.c: Added do-while pair for complex macros
Message-ID<qz8ds-86E-21@gated-at.bofh.it>
In reply to#1278336
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));


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1278460 — Re: [PATCH] staging: net: core: skbuff.c: Added do-while pair for complex macros

FromDavid Miller <davem@davemloft.net>
Date2015-11-26 22:50 +0100
SubjectRe: [PATCH] staging: net: core: skbuff.c: Added do-while pair for complex macros
Message-ID<qzcAp-2gR-5@gated-at.bofh.it>
In reply to#1278336
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web