netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 1/3] sock: fix a typo in the comment
@ 2013-08-06  7:32 Jean Sacren
  2013-08-06  7:32 ` [PATCH net-next 2/3] netdevice: remove useless else keyword Jean Sacren
  2013-08-06  7:32 ` [PATCH net-next 3/3] net: core: fix wrong linkage for ptype_base and ptype_all symbols Jean Sacren
  0 siblings, 2 replies; 9+ messages in thread
From: Jean Sacren @ 2013-08-06  7:32 UTC (permalink / raw)
  To: netdev

Correct 'transfert' to 'transfer' to better deliver the original
author's message.

Signed-off-by: Jean Sacren <sakiwit@gmail.com>
---
 net/core/sock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/sock.c b/net/core/sock.c
index 83667de..811de47 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1579,7 +1579,7 @@ EXPORT_SYMBOL(sock_wfree);
 void skb_orphan_partial(struct sk_buff *skb)
 {
 	/* TCP stack sets skb->ooo_okay based on sk_wmem_alloc,
-	 * so we do not completely orphan skb, but transfert all
+	 * so we do not completely orphan skb, but transfer all
 	 * accounted bytes but one, to avoid unexpected reorders.
 	 */
 	if (skb->destructor == sock_wfree

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

* [PATCH net-next 2/3] netdevice: remove useless else keyword
  2013-08-06  7:32 [PATCH net-next 1/3] sock: fix a typo in the comment Jean Sacren
@ 2013-08-06  7:32 ` Jean Sacren
  2013-08-06  8:20   ` Daniel Borkmann
  2013-08-06  7:32 ` [PATCH net-next 3/3] net: core: fix wrong linkage for ptype_base and ptype_all symbols Jean Sacren
  1 sibling, 1 reply; 9+ messages in thread
From: Jean Sacren @ 2013-08-06  7:32 UTC (permalink / raw)
  To: netdev

Clean up multiple useless else keywords. Add empty lines for
readability.

Signed-off-by: Jean Sacren <sakiwit@gmail.com>
---
 net/core/dev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 58eb802..1b0bea8 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1062,9 +1062,11 @@ static int dev_get_valid_name(struct net *net,
 
 	if (strchr(name, '%'))
 		return dev_alloc_name_ns(net, dev, name);
-	else if (__dev_get_by_name(net, name))
+
+	if (__dev_get_by_name(net, name))
 		return -EEXIST;
-	else if (dev->name != name)
+
+	if (dev->name != name)
 		strlcpy(dev->name, name, IFNAMSIZ);
 
 	return 0;

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

* [PATCH net-next 3/3] net: core: fix wrong linkage for ptype_base and ptype_all symbols
  2013-08-06  7:32 [PATCH net-next 1/3] sock: fix a typo in the comment Jean Sacren
  2013-08-06  7:32 ` [PATCH net-next 2/3] netdevice: remove useless else keyword Jean Sacren
@ 2013-08-06  7:32 ` Jean Sacren
  2013-08-06  8:13   ` Daniel Borkmann
  1 sibling, 1 reply; 9+ messages in thread
From: Jean Sacren @ 2013-08-06  7:32 UTC (permalink / raw)
  To: netdev

In commit 900ff8c6 ("net: move procfs code to net/core/net-procfs.c"),
it changed the correct linkage of ptype_base and ptype_all symbols to
the wrong one in net/core/dev.c, yet failed to change to the correct
linkage of those two in net/core/net-procfs.c.

Fix the wrong linkage by setting static specifier to both sets of the
symbols so that they could have coherent internal linkage by themselves
to avoid interference with each other.

Signed-off-by: Jean Sacren <sakiwit@gmail.com>
---
 net/core/dev.c        | 4 ++--
 net/core/net-procfs.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index dfd9f5d..d85e5e1 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -142,8 +142,8 @@
 
 static DEFINE_SPINLOCK(ptype_lock);
 static DEFINE_SPINLOCK(offload_lock);
-struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
-struct list_head ptype_all __read_mostly;	/* Taps */
+static struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
+static struct list_head ptype_all __read_mostly;	/* Taps */
 static struct list_head offload_base __read_mostly;
 
 /*
diff --git a/net/core/net-procfs.c b/net/core/net-procfs.c
index 2bf8329..e57cd63 100644
--- a/net/core/net-procfs.c
+++ b/net/core/net-procfs.c
@@ -9,8 +9,8 @@
 #define get_offset(x) ((x) & ((1 << BUCKET_SPACE) - 1))
 #define set_bucket_offset(b, o) ((b) << BUCKET_SPACE | (o))
 
-extern struct list_head ptype_all __read_mostly;
-extern struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
+static struct list_head ptype_all __read_mostly;
+static struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
 
 static inline struct net_device *dev_from_same_bucket(struct seq_file *seq, loff_t *pos)
 {

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

* Re: [PATCH net-next 3/3] net: core: fix wrong linkage for ptype_base and ptype_all symbols
  2013-08-06  7:32 ` [PATCH net-next 3/3] net: core: fix wrong linkage for ptype_base and ptype_all symbols Jean Sacren
@ 2013-08-06  8:13   ` Daniel Borkmann
  2013-08-06 20:45     ` Jean Sacren
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Borkmann @ 2013-08-06  8:13 UTC (permalink / raw)
  To: Jean Sacren; +Cc: netdev

On 08/06/2013 09:32 AM, Jean Sacren wrote:
> In commit 900ff8c6 ("net: move procfs code to net/core/net-procfs.c"),
> it changed the correct linkage of ptype_base and ptype_all symbols to
> the wrong one in net/core/dev.c, yet failed to change to the correct
> linkage of those two in net/core/net-procfs.c.
>
> Fix the wrong linkage by setting static specifier to both sets of the
> symbols so that they could have coherent internal linkage by themselves
> to avoid interference with each other.

Ho? I do not think this is correct, what makes you think so?

The net-procfs.c usage of ptype_* is there to show current pf_packet users
via seq_files in procfs. Your patch will just break this.

> Signed-off-by: Jean Sacren <sakiwit@gmail.com>
> ---
>   net/core/dev.c        | 4 ++--
>   net/core/net-procfs.c | 4 ++--
>   2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index dfd9f5d..d85e5e1 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -142,8 +142,8 @@
>
>   static DEFINE_SPINLOCK(ptype_lock);
>   static DEFINE_SPINLOCK(offload_lock);
> -struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
> -struct list_head ptype_all __read_mostly;	/* Taps */
> +static struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
> +static struct list_head ptype_all __read_mostly;	/* Taps */
>   static struct list_head offload_base __read_mostly;
>
>   /*
> diff --git a/net/core/net-procfs.c b/net/core/net-procfs.c
> index 2bf8329..e57cd63 100644
> --- a/net/core/net-procfs.c
> +++ b/net/core/net-procfs.c
> @@ -9,8 +9,8 @@
>   #define get_offset(x) ((x) & ((1 << BUCKET_SPACE) - 1))
>   #define set_bucket_offset(b, o) ((b) << BUCKET_SPACE | (o))
>
> -extern struct list_head ptype_all __read_mostly;
> -extern struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
> +static struct list_head ptype_all __read_mostly;
> +static struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
>
>   static inline struct net_device *dev_from_same_bucket(struct seq_file *seq, loff_t *pos)
>   {
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

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

* Re: [PATCH net-next 2/3] netdevice: remove useless else keyword
  2013-08-06  7:32 ` [PATCH net-next 2/3] netdevice: remove useless else keyword Jean Sacren
@ 2013-08-06  8:20   ` Daniel Borkmann
  2013-08-06 14:37     ` Joe Perches
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Borkmann @ 2013-08-06  8:20 UTC (permalink / raw)
  To: Jean Sacren; +Cc: netdev

On 08/06/2013 09:32 AM, Jean Sacren wrote:
> Clean up multiple useless else keywords. Add empty lines for
> readability.

Hmm, don't really think this is actually needed or makes things better.

> Signed-off-by: Jean Sacren <sakiwit@gmail.com>
> ---
>   net/core/dev.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 58eb802..1b0bea8 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1062,9 +1062,11 @@ static int dev_get_valid_name(struct net *net,
>
>   	if (strchr(name, '%'))
>   		return dev_alloc_name_ns(net, dev, name);
> -	else if (__dev_get_by_name(net, name))
> +
> +	if (__dev_get_by_name(net, name))
>   		return -EEXIST;
> -	else if (dev->name != name)
> +
> +	if (dev->name != name)
>   		strlcpy(dev->name, name, IFNAMSIZ);
>
>   	return 0;
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

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

* Re: [PATCH net-next 2/3] netdevice: remove useless else keyword
  2013-08-06  8:20   ` Daniel Borkmann
@ 2013-08-06 14:37     ` Joe Perches
  0 siblings, 0 replies; 9+ messages in thread
From: Joe Perches @ 2013-08-06 14:37 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: Jean Sacren, netdev

On Tue, 2013-08-06 at 10:20 +0200, Daniel Borkmann wrote:
> On 08/06/2013 09:32 AM, Jean Sacren wrote:
> > Clean up multiple useless else keywords. Add empty lines for
> > readability.
> 
> Hmm, don't really think this is actually needed or makes things better.

Maybe that's true.

Though this patch is pretty trivial and
I would (probably) not submit it, I think
it's a reasonable style rule to not use
else after an if() that always returns.

	if (foo)
		return bar;

	next_statement;

should be preferred over

	if (foo)
		return bar;
	else
		next_statement;

The blank lines though are a style taste.
Maybe removing the blank line before the
first if in this patch might be better.

{
	BUG_ON(!net);

	if (!dev_valid_name(name))
		return -EINVAL;
	if (strchr(name, '%'))
		return dev_alloc_name_ns(net, dev, name);
	if (__dev_get_by_name(net, name))
		return -EEXIST;
	if (dev->name != name)
		strlcpy(dev->name, name, IFNAMSIZ);

	return 0;
}

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

* Re: [PATCH net-next 3/3] net: core: fix wrong linkage for ptype_base and ptype_all symbols
  2013-08-06  8:13   ` Daniel Borkmann
@ 2013-08-06 20:45     ` Jean Sacren
  2013-08-06 21:06       ` Eric Dumazet
  0 siblings, 1 reply; 9+ messages in thread
From: Jean Sacren @ 2013-08-06 20:45 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: netdev

From: Daniel Borkmann <dborkman@redhat.com>
Date: Tue, 06 Aug 2013 10:13:15 +0200
>
> On 08/06/2013 09:32 AM, Jean Sacren wrote:
> > In commit 900ff8c6 ("net: move procfs code to net/core/net-procfs.c"),
> > it changed the correct linkage of ptype_base and ptype_all symbols to
> > the wrong one in net/core/dev.c, yet failed to change to the correct
> > linkage of those two in net/core/net-procfs.c.
> >
> > Fix the wrong linkage by setting static specifier to both sets of the
> > symbols so that they could have coherent internal linkage by themselves
> > to avoid interference with each other.
> 
> Ho? I do not think this is correct, what makes you think so?

Thank you for the awesome comment.

I'm sorry to tell you but the patch is correct. Both symbols of
ptype_{base,all} were wrongly declared as extern in net-procfs.c in the
first place.

> The net-procfs.c usage of ptype_* is there to show current pf_packet users
> via seq_files in procfs. Your patch will just break this.

I validated it before I submitted the patch that all the symbols of
ptype_{base,all} are used exclusively in net/core/net-procfs.c and
net/core/dev.c but not outside of those two places. Therefore, your
assumption for breakage is groundless.

As a kernel networking guru as you are, you shall have the lab and all
sorts of test cases to validate patches. I'd love to run this type of
testing by myself, but I don't have such resources. If you could test
this patch in any of your setup and prove that I'm wrong, I'd extremely
appreciate it. Thank you in advance.

I'm looking forward to being taught more.

-- 
Jean Sacren

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

* Re: [PATCH net-next 3/3] net: core: fix wrong linkage for ptype_base and ptype_all symbols
  2013-08-06 20:45     ` Jean Sacren
@ 2013-08-06 21:06       ` Eric Dumazet
  2013-08-07  4:00         ` Jean Sacren
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Dumazet @ 2013-08-06 21:06 UTC (permalink / raw)
  To: Jean Sacren; +Cc: Daniel Borkmann, netdev

On Tue, 2013-08-06 at 14:45 -0600, Jean Sacren wrote:

> I'm sorry to tell you but the patch is correct. Both symbols of
> ptype_{base,all} were wrongly declared as extern in net-procfs.c in the
> first place.

You are mistaken.

> > The net-procfs.c usage of ptype_* is there to show current pf_packet users
> > via seq_files in procfs. Your patch will just break this.
> 
> I validated it before I submitted the patch that all the symbols of
> ptype_{base,all} are used exclusively in net/core/net-procfs.c and
> net/core/dev.c but not outside of those two places. Therefore, your
> assumption for breakage is groundless.
> 
> As a kernel networking guru as you are, you shall have the lab and all
> sorts of test cases to validate patches. I'd love to run this type of
> testing by myself, but I don't have such resources. If you could test
> this patch in any of your setup and prove that I'm wrong, I'd extremely
> appreciate it. Thank you in advance.
> 
> I'm looking forward to being taught more.
> 


Well, the patch is wrong, for sure, and you cannot ask us to test your
patches.

Do not send patches that you cannot test yourself, please.

Try this before/after your patch

cat /proc/net/ptype

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

* Re: [PATCH net-next 3/3] net: core: fix wrong linkage for ptype_base and ptype_all symbols
  2013-08-06 21:06       ` Eric Dumazet
@ 2013-08-07  4:00         ` Jean Sacren
  0 siblings, 0 replies; 9+ messages in thread
From: Jean Sacren @ 2013-08-07  4:00 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Daniel Borkmann, netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 06 Aug 2013 14:06:41 -0700
>
> On Tue, 2013-08-06 at 14:45 -0600, Jean Sacren wrote:
> 
> > I'm sorry to tell you but the patch is correct. Both symbols of
> > ptype_{base,all} were wrongly declared as extern in net-procfs.c in the
> > first place.
> 
> You are mistaken.

Sorry for the big mistake.

-- 
Jean Sacren

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

end of thread, other threads:[~2013-08-07  4:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-06  7:32 [PATCH net-next 1/3] sock: fix a typo in the comment Jean Sacren
2013-08-06  7:32 ` [PATCH net-next 2/3] netdevice: remove useless else keyword Jean Sacren
2013-08-06  8:20   ` Daniel Borkmann
2013-08-06 14:37     ` Joe Perches
2013-08-06  7:32 ` [PATCH net-next 3/3] net: core: fix wrong linkage for ptype_base and ptype_all symbols Jean Sacren
2013-08-06  8:13   ` Daniel Borkmann
2013-08-06 20:45     ` Jean Sacren
2013-08-06 21:06       ` Eric Dumazet
2013-08-07  4:00         ` Jean Sacren

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