All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/5] net sched actions: code style cleanup and fixes
@ 2018-06-19 16:56 Roman Mashak
  2018-06-19 16:56 ` [PATCH net 1/5] net sched actions: fix coding style in pedit action Roman Mashak
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Roman Mashak @ 2018-06-19 16:56 UTC (permalink / raw)
  To: davem; +Cc: netdev, kernel, jhs, xiyou.wangcong, jiri, Roman Mashak

The patchset fixes a few code stylistic issues and typos, as well as one
detected by sparse semantic checker tool.

No functional changes introduced.

Patch 1 & 2 fix coding style bits caught by the checkpatch.pl script
Patch 3 fixes an issue with a shadowed variable
Patch 4 adds sizeof() operator instead of magic number for buffer length
Patch 5 fixes typos in diagnostics messages

Roman Mashak (5):
  net sched actions: fix coding style in pedit action
  net sched actions: fix coding style in pedit headers
  net sched actions: fix sparse warning
  net sched actions: use sizeof operator for buffer length
  net sched actions: fix misleading text strings in pedit action

 include/net/tc_act/tc_pedit.h        |  1 +
 include/uapi/linux/tc_act/tc_pedit.h |  9 ++++++--
 net/sched/act_pedit.c                | 41 +++++++++++++++++++-----------------
 3 files changed, 30 insertions(+), 21 deletions(-)

-- 
2.7.4

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

* [PATCH net 1/5] net sched actions: fix coding style in pedit action
  2018-06-19 16:56 [PATCH net 0/5] net sched actions: code style cleanup and fixes Roman Mashak
@ 2018-06-19 16:56 ` Roman Mashak
  2018-06-20 12:29   ` Davide Caratti
  2018-06-19 16:56 ` [PATCH net 2/5] net sched actions: fix coding style in pedit headers Roman Mashak
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Roman Mashak @ 2018-06-19 16:56 UTC (permalink / raw)
  To: davem; +Cc: netdev, kernel, jhs, xiyou.wangcong, jiri, Roman Mashak

Fix coding style issues in tc pedit action detected by the
checkpatch script.

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
---
 net/sched/act_pedit.c | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index 8a925c72db5f..e4b29ee79ba8 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -136,15 +136,15 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla,
 {
 	struct tc_action_net *tn = net_generic(net, pedit_net_id);
 	struct nlattr *tb[TCA_PEDIT_MAX + 1];
-	struct nlattr *pattr;
-	struct tc_pedit *parm;
-	int ret = 0, err;
-	struct tcf_pedit *p;
 	struct tc_pedit_key *keys = NULL;
 	struct tcf_pedit_key_ex *keys_ex;
+	struct tc_pedit *parm;
+	struct nlattr *pattr;
+	struct tcf_pedit *p;
+	int ret = 0, err;
 	int ksize;
 
-	if (nla == NULL)
+	if (!nla)
 		return -EINVAL;
 
 	err = nla_parse_nested(tb, TCA_PEDIT_MAX, nla, pedit_policy, NULL);
@@ -175,7 +175,7 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla,
 			return ret;
 		p = to_pedit(*a);
 		keys = kmalloc(ksize, GFP_KERNEL);
-		if (keys == NULL) {
+		if (!keys) {
 			tcf_idr_release(*a, bind);
 			kfree(keys_ex);
 			return -ENOMEM;
@@ -220,6 +220,7 @@ static void tcf_pedit_cleanup(struct tc_action *a)
 {
 	struct tcf_pedit *p = to_pedit(a);
 	struct tc_pedit_key *keys = p->tcfp_keys;
+
 	kfree(keys);
 	kfree(p->tcfp_keys_ex);
 }
@@ -284,7 +285,8 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
 	if (p->tcfp_nkeys > 0) {
 		struct tc_pedit_key *tkey = p->tcfp_keys;
 		struct tcf_pedit_key_ex *tkey_ex = p->tcfp_keys_ex;
-		enum pedit_header_type htype = TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK;
+		enum pedit_header_type htype =
+			TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK;
 		enum pedit_cmd cmd = TCA_PEDIT_KEY_EX_CMD_SET;
 
 		for (i = p->tcfp_nkeys; i > 0; i--, tkey++) {
@@ -316,16 +318,15 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
 						hoffset + tkey->at);
 					goto bad;
 				}
-				d = skb_header_pointer(skb, hoffset + tkey->at, 1,
-						       &_d);
+				d = skb_header_pointer(skb, hoffset + tkey->at,
+						       1, &_d);
 				if (!d)
 					goto bad;
 				offset += (*d & tkey->offmask) >> tkey->shift;
 			}
 
 			if (offset % 4) {
-				pr_info("tc filter pedit"
-					" offset must be on 32 bit boundaries\n");
+				pr_info("tc filter pedit offset must be on 32 bit boundaries\n");
 				goto bad;
 			}
 
@@ -335,7 +336,8 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
 				goto bad;
 			}
 
-			ptr = skb_header_pointer(skb, hoffset + offset, 4, &_data);
+			ptr = skb_header_pointer(skb, hoffset + offset,
+						 4, &_data);
 			if (!ptr)
 				goto bad;
 			/* just do it, baby */
@@ -358,8 +360,9 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
 		}
 
 		goto done;
-	} else
+	} else {
 		WARN(1, "pedit BUG: index %d\n", p->tcf_index);
+	}
 
 bad:
 	p->tcf_qstats.overlimits++;
-- 
2.7.4

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

* [PATCH net 2/5] net sched actions: fix coding style in pedit headers
  2018-06-19 16:56 [PATCH net 0/5] net sched actions: code style cleanup and fixes Roman Mashak
  2018-06-19 16:56 ` [PATCH net 1/5] net sched actions: fix coding style in pedit action Roman Mashak
@ 2018-06-19 16:56 ` Roman Mashak
  2018-06-19 16:56 ` [PATCH net 3/5] net sched actions: fix sparse warning Roman Mashak
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Roman Mashak @ 2018-06-19 16:56 UTC (permalink / raw)
  To: davem; +Cc: netdev, kernel, jhs, xiyou.wangcong, jiri, Roman Mashak

Fix coding style issues in tc pedit headers detected by the
checkpatch script.

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
---
 include/net/tc_act/tc_pedit.h        | 1 +
 include/uapi/linux/tc_act/tc_pedit.h | 9 +++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/net/tc_act/tc_pedit.h b/include/net/tc_act/tc_pedit.h
index 227a6f1d02f4..fac3ad4a86de 100644
--- a/include/net/tc_act/tc_pedit.h
+++ b/include/net/tc_act/tc_pedit.h
@@ -17,6 +17,7 @@ struct tcf_pedit {
 	struct tc_pedit_key	*tcfp_keys;
 	struct tcf_pedit_key_ex	*tcfp_keys_ex;
 };
+
 #define to_pedit(a) ((struct tcf_pedit *)a)
 
 static inline bool is_tcf_pedit(const struct tc_action *a)
diff --git a/include/uapi/linux/tc_act/tc_pedit.h b/include/uapi/linux/tc_act/tc_pedit.h
index 162d1094c41c..24ec792dacc1 100644
--- a/include/uapi/linux/tc_act/tc_pedit.h
+++ b/include/uapi/linux/tc_act/tc_pedit.h
@@ -17,13 +17,15 @@ enum {
 	TCA_PEDIT_KEY_EX,
 	__TCA_PEDIT_MAX
 };
+
 #define TCA_PEDIT_MAX (__TCA_PEDIT_MAX - 1)
-                                                                                
+
 enum {
 	TCA_PEDIT_KEY_EX_HTYPE = 1,
 	TCA_PEDIT_KEY_EX_CMD = 2,
 	__TCA_PEDIT_KEY_EX_MAX
 };
+
 #define TCA_PEDIT_KEY_EX_MAX (__TCA_PEDIT_KEY_EX_MAX - 1)
 
  /* TCA_PEDIT_KEY_EX_HDR_TYPE_NETWROK is a special case for legacy users. It
@@ -38,6 +40,7 @@ enum pedit_header_type {
 	TCA_PEDIT_KEY_EX_HDR_TYPE_UDP = 5,
 	__PEDIT_HDR_TYPE_MAX,
 };
+
 #define TCA_PEDIT_HDR_TYPE_MAX (__PEDIT_HDR_TYPE_MAX - 1)
 
 enum pedit_cmd {
@@ -45,6 +48,7 @@ enum pedit_cmd {
 	TCA_PEDIT_KEY_EX_CMD_ADD = 1,
 	__PEDIT_CMD_MAX,
 };
+
 #define TCA_PEDIT_CMD_MAX (__PEDIT_CMD_MAX - 1)
 
 struct tc_pedit_key {
@@ -55,13 +59,14 @@ struct tc_pedit_key {
 	__u32           offmask;
 	__u32           shift;
 };
-                                                                                
+
 struct tc_pedit_sel {
 	tc_gen;
 	unsigned char           nkeys;
 	unsigned char           flags;
 	struct tc_pedit_key     keys[0];
 };
+
 #define tc_pedit tc_pedit_sel
 
 #endif
-- 
2.7.4

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

* [PATCH net 3/5] net sched actions: fix sparse warning
  2018-06-19 16:56 [PATCH net 0/5] net sched actions: code style cleanup and fixes Roman Mashak
  2018-06-19 16:56 ` [PATCH net 1/5] net sched actions: fix coding style in pedit action Roman Mashak
  2018-06-19 16:56 ` [PATCH net 2/5] net sched actions: fix coding style in pedit headers Roman Mashak
@ 2018-06-19 16:56 ` Roman Mashak
  2018-06-19 16:56 ` [PATCH net 4/5] net sched actions: use sizeof operator for buffer length Roman Mashak
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Roman Mashak @ 2018-06-19 16:56 UTC (permalink / raw)
  To: davem; +Cc: netdev, kernel, jhs, xiyou.wangcong, jiri, Roman Mashak

The variable _data in include/asm-generic/sections.h defines sections,
this causes sparse warning in pedit:

net/sched/act_pedit.c:293:35: warning: symbol '_data' shadows an earlier one
./include/asm-generic/sections.h:36:13: originally declared here

Therefore rename the variable.

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
---
 net/sched/act_pedit.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index e4b29ee79ba8..9c2d8a31a5c5 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -290,7 +290,7 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
 		enum pedit_cmd cmd = TCA_PEDIT_KEY_EX_CMD_SET;
 
 		for (i = p->tcfp_nkeys; i > 0; i--, tkey++) {
-			u32 *ptr, _data;
+			u32 *ptr, hdata;
 			int offset = tkey->off;
 			int hoffset;
 			u32 val;
@@ -337,7 +337,7 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
 			}
 
 			ptr = skb_header_pointer(skb, hoffset + offset,
-						 4, &_data);
+						 4, &hdata);
 			if (!ptr)
 				goto bad;
 			/* just do it, baby */
@@ -355,7 +355,7 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
 			}
 
 			*ptr = ((*ptr & tkey->mask) ^ val);
-			if (ptr == &_data)
+			if (ptr == &hdata)
 				skb_store_bits(skb, hoffset + offset, ptr, 4);
 		}
 
-- 
2.7.4

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

* [PATCH net 4/5] net sched actions: use sizeof operator for buffer length
  2018-06-19 16:56 [PATCH net 0/5] net sched actions: code style cleanup and fixes Roman Mashak
                   ` (2 preceding siblings ...)
  2018-06-19 16:56 ` [PATCH net 3/5] net sched actions: fix sparse warning Roman Mashak
@ 2018-06-19 16:56 ` Roman Mashak
  2018-06-19 16:56 ` [PATCH net 5/5] net sched actions: fix misleading text strings in pedit action Roman Mashak
  2018-06-20  8:20 ` [PATCH net 0/5] net sched actions: code style cleanup and fixes Simon Horman
  5 siblings, 0 replies; 11+ messages in thread
From: Roman Mashak @ 2018-06-19 16:56 UTC (permalink / raw)
  To: davem; +Cc: netdev, kernel, jhs, xiyou.wangcong, jiri, Roman Mashak

Replace constant integer with sizeof() to clearly indicate
the destination buffer length in skb_header_pointer() calls.

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
---
 net/sched/act_pedit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index 9c2d8a31a5c5..3b775f54cee5 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -319,7 +319,7 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
 					goto bad;
 				}
 				d = skb_header_pointer(skb, hoffset + tkey->at,
-						       1, &_d);
+						       sizeof(_d), &_d);
 				if (!d)
 					goto bad;
 				offset += (*d & tkey->offmask) >> tkey->shift;
@@ -337,7 +337,7 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
 			}
 
 			ptr = skb_header_pointer(skb, hoffset + offset,
-						 4, &hdata);
+						 sizeof(hdata), &hdata);
 			if (!ptr)
 				goto bad;
 			/* just do it, baby */
-- 
2.7.4

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

* [PATCH net 5/5] net sched actions: fix misleading text strings in pedit action
  2018-06-19 16:56 [PATCH net 0/5] net sched actions: code style cleanup and fixes Roman Mashak
                   ` (3 preceding siblings ...)
  2018-06-19 16:56 ` [PATCH net 4/5] net sched actions: use sizeof operator for buffer length Roman Mashak
@ 2018-06-19 16:56 ` Roman Mashak
  2018-06-19 17:04   ` Stephen Hemminger
  2018-06-20  8:20 ` [PATCH net 0/5] net sched actions: code style cleanup and fixes Simon Horman
  5 siblings, 1 reply; 11+ messages in thread
From: Roman Mashak @ 2018-06-19 16:56 UTC (permalink / raw)
  To: davem; +Cc: netdev, kernel, jhs, xiyou.wangcong, jiri, Roman Mashak

Change "tc filter pedit .." to "tc actions pedit .." in error
messages to clearly refer to pedit action.

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
---
 net/sched/act_pedit.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index 3b775f54cee5..caa6927a992c 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -305,7 +305,7 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
 
 			rc = pedit_skb_hdr_offset(skb, htype, &hoffset);
 			if (rc) {
-				pr_info("tc filter pedit bad header type specified (0x%x)\n",
+				pr_info("tc action pedit bad header type specified (0x%x)\n",
 					htype);
 				goto bad;
 			}
@@ -314,7 +314,7 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
 				char *d, _d;
 
 				if (!offset_valid(skb, hoffset + tkey->at)) {
-					pr_info("tc filter pedit 'at' offset %d out of bounds\n",
+					pr_info("tc action pedit 'at' offset %d out of bounds\n",
 						hoffset + tkey->at);
 					goto bad;
 				}
@@ -326,12 +326,12 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
 			}
 
 			if (offset % 4) {
-				pr_info("tc filter pedit offset must be on 32 bit boundaries\n");
+				pr_info("tc action pedit offset must be on 32 bit boundaries\n");
 				goto bad;
 			}
 
 			if (!offset_valid(skb, hoffset + offset)) {
-				pr_info("tc filter pedit offset %d out of bounds\n",
+				pr_info("tc action pedit offset %d out of bounds\n",
 					hoffset + offset);
 				goto bad;
 			}
@@ -349,7 +349,7 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
 				val = (*ptr + tkey->val) & ~tkey->mask;
 				break;
 			default:
-				pr_info("tc filter pedit bad command (%d)\n",
+				pr_info("tc action pedit bad command (%d)\n",
 					cmd);
 				goto bad;
 			}
-- 
2.7.4

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

* Re: [PATCH net 5/5] net sched actions: fix misleading text strings in pedit action
  2018-06-19 16:56 ` [PATCH net 5/5] net sched actions: fix misleading text strings in pedit action Roman Mashak
@ 2018-06-19 17:04   ` Stephen Hemminger
  2018-06-19 17:15     ` Roman Mashak
  0 siblings, 1 reply; 11+ messages in thread
From: Stephen Hemminger @ 2018-06-19 17:04 UTC (permalink / raw)
  To: Roman Mashak; +Cc: davem, netdev, kernel, jhs, xiyou.wangcong, jiri

On Tue, 19 Jun 2018 12:56:08 -0400
Roman Mashak <mrv@mojatatu.com> wrote:

> Change "tc filter pedit .." to "tc actions pedit .." in error
> messages to clearly refer to pedit action.
> 
> Signed-off-by: Roman Mashak <mrv@mojatatu.com>
> ---
>  net/sched/act_pedit.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
> index 3b775f54cee5..caa6927a992c 100644
> --- a/net/sched/act_pedit.c
> +++ b/net/sched/act_pedit.c
> @@ -305,7 +305,7 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
>  
>  			rc = pedit_skb_hdr_offset(skb, htype, &hoffset);
>  			if (rc) {
> -				pr_info("tc filter pedit bad header type specified (0x%x)\n",
> +				pr_info("tc action pedit bad header type specified (0x%x)\n",
>  					htype);
>  				goto bad;
>  			}
> @@ -314,7 +314,7 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
>  				char *d, _d;
>  
>  				if (!offset_valid(skb, hoffset + tkey->at)) {
> -					pr_info("tc filter pedit 'at' offset %d out of bounds\n",
> +					pr_info("tc action pedit 'at' offset %d out of bounds\n",
>  						hoffset + tkey->at);
>  					goto bad;
>  				}
> @@ -326,12 +326,12 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
>  			}
>  
>  			if (offset % 4) {
> -				pr_info("tc filter pedit offset must be on 32 bit boundaries\n");
> +				pr_info("tc action pedit offset must be on 32 bit boundaries\n");
>  				goto bad;
>  			}
>  
>  			if (!offset_valid(skb, hoffset + offset)) {
> -				pr_info("tc filter pedit offset %d out of bounds\n",
> +				pr_info("tc action pedit offset %d out of bounds\n",
>  					hoffset + offset);
>  				goto bad;

Time to convert these to netlink extack reporting?

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

* Re: [PATCH net 5/5] net sched actions: fix misleading text strings in pedit action
  2018-06-19 17:04   ` Stephen Hemminger
@ 2018-06-19 17:15     ` Roman Mashak
  0 siblings, 0 replies; 11+ messages in thread
From: Roman Mashak @ 2018-06-19 17:15 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: davem, netdev, kernel, jhs, xiyou.wangcong, jiri

Stephen Hemminger <stephen@networkplumber.org> writes:

> On Tue, 19 Jun 2018 12:56:08 -0400

[...]

>> @@ -326,12 +326,12 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
>>  			}
>>  
>>  			if (offset % 4) {
>> -				pr_info("tc filter pedit offset must be on 32 bit boundaries\n");
>> +				pr_info("tc action pedit offset must be on 32 bit boundaries\n");
>>  				goto bad;
>>  			}
>>  
>>  			if (!offset_valid(skb, hoffset + offset)) {
>> -				pr_info("tc filter pedit offset %d out of bounds\n",
>> +				pr_info("tc action pedit offset %d out of bounds\n",
>>  					hoffset + offset);
>>  				goto bad;
>
> Time to convert these to netlink extack reporting?

Yes, this is planned in next patches.

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

* Re: [PATCH net 0/5] net sched actions: code style cleanup and fixes
  2018-06-19 16:56 [PATCH net 0/5] net sched actions: code style cleanup and fixes Roman Mashak
                   ` (4 preceding siblings ...)
  2018-06-19 16:56 ` [PATCH net 5/5] net sched actions: fix misleading text strings in pedit action Roman Mashak
@ 2018-06-20  8:20 ` Simon Horman
  5 siblings, 0 replies; 11+ messages in thread
From: Simon Horman @ 2018-06-20  8:20 UTC (permalink / raw)
  To: Roman Mashak; +Cc: davem, netdev, kernel, jhs, xiyou.wangcong, jiri

On Tue, Jun 19, 2018 at 12:56:03PM -0400, Roman Mashak wrote:
> The patchset fixes a few code stylistic issues and typos, as well as one
> detected by sparse semantic checker tool.
> 
> No functional changes introduced.
> 
> Patch 1 & 2 fix coding style bits caught by the checkpatch.pl script
> Patch 3 fixes an issue with a shadowed variable
> Patch 4 adds sizeof() operator instead of magic number for buffer length
> Patch 5 fixes typos in diagnostics messages
> 
> Roman Mashak (5):
>   net sched actions: fix coding style in pedit action
>   net sched actions: fix coding style in pedit headers
>   net sched actions: fix sparse warning
>   net sched actions: use sizeof operator for buffer length
>   net sched actions: fix misleading text strings in pedit action

All patches:

Reviewed-by: Simon Horman <simon.horman@netronome.com>

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

* Re: [PATCH net 1/5] net sched actions: fix coding style in pedit action
  2018-06-19 16:56 ` [PATCH net 1/5] net sched actions: fix coding style in pedit action Roman Mashak
@ 2018-06-20 12:29   ` Davide Caratti
  2018-06-20 13:25     ` Roman Mashak
  0 siblings, 1 reply; 11+ messages in thread
From: Davide Caratti @ 2018-06-20 12:29 UTC (permalink / raw)
  To: Roman Mashak, davem; +Cc: netdev, kernel, jhs, xiyou.wangcong, jiri

On Tue, 2018-06-19 at 12:56 -0400, Roman Mashak wrote:
> Fix coding style issues in tc pedit action detected by the
> checkpatch script.
> 
> Signed-off-by: Roman Mashak <mrv@mojatatu.com>
...

> ---
> @@ -316,16 +318,15 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
>  						hoffset + tkey->at);
>  					goto bad;
>  				}
> -				d = skb_header_pointer(skb, hoffset + tkey->at, 1,
> -						       &_d);
> +				d = skb_header_pointer(skb, hoffset + tkey->at,
> +						       1, &_d);
> 				if (!d)
>  					goto bad;
>  				offset += (*d & tkey->offmask) >> tkey->shift;
>  			}

hello Roman,

nit: while we are here, what about changing the declaration of _d and *d
to u8, so that the bitwise operation is done on unsigned?

BTW: the patch (and the series) looks ok, but I guess it will better
target net-next when the branch reopens

thanks!
-- 
davide

 

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

* Re: [PATCH net 1/5] net sched actions: fix coding style in pedit action
  2018-06-20 12:29   ` Davide Caratti
@ 2018-06-20 13:25     ` Roman Mashak
  0 siblings, 0 replies; 11+ messages in thread
From: Roman Mashak @ 2018-06-20 13:25 UTC (permalink / raw)
  To: Davide Caratti; +Cc: davem, netdev, kernel, jhs, xiyou.wangcong, jiri

Davide Caratti <dcaratti@redhat.com> writes:

> On Tue, 2018-06-19 at 12:56 -0400, Roman Mashak wrote:
>> Fix coding style issues in tc pedit action detected by the
>> checkpatch script.
>> 
>> Signed-off-by: Roman Mashak <mrv@mojatatu.com>
> ...
>
>> ---
>> @@ -316,16 +318,15 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
>>  						hoffset + tkey->at);
>>  					goto bad;
>>  				}
>> -				d = skb_header_pointer(skb, hoffset + tkey->at, 1,
>> -						       &_d);
>> +				d = skb_header_pointer(skb, hoffset + tkey->at,
>> +						       1, &_d);
>> 				if (!d)
>>  					goto bad;
>>  				offset += (*d & tkey->offmask) >> tkey->shift;
>>  			}
>
> hello Roman,
>
> nit: while we are here, what about changing the declaration of _d and *d
> to u8, so that the bitwise operation is done on unsigned?

Yes makes sense, I will send v2 in net-next once opened. Thanks Davide.

> BTW: the patch (and the series) looks ok, but I guess it will better
> target net-next when the branch reopens

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

end of thread, other threads:[~2018-06-20 13:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-19 16:56 [PATCH net 0/5] net sched actions: code style cleanup and fixes Roman Mashak
2018-06-19 16:56 ` [PATCH net 1/5] net sched actions: fix coding style in pedit action Roman Mashak
2018-06-20 12:29   ` Davide Caratti
2018-06-20 13:25     ` Roman Mashak
2018-06-19 16:56 ` [PATCH net 2/5] net sched actions: fix coding style in pedit headers Roman Mashak
2018-06-19 16:56 ` [PATCH net 3/5] net sched actions: fix sparse warning Roman Mashak
2018-06-19 16:56 ` [PATCH net 4/5] net sched actions: use sizeof operator for buffer length Roman Mashak
2018-06-19 16:56 ` [PATCH net 5/5] net sched actions: fix misleading text strings in pedit action Roman Mashak
2018-06-19 17:04   ` Stephen Hemminger
2018-06-19 17:15     ` Roman Mashak
2018-06-20  8:20 ` [PATCH net 0/5] net sched actions: code style cleanup and fixes Simon Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.