Skip to contentSkip to conversation

net/core/sysctl_net_core.c unused variable

PATCH In review Nick Warne 2 participants 6 messages Sep 6, 2015 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Nick Warne

author
#0 lore raw

PATCH 1/1 net/core/sysctl_net_core.c unused variable

gcc version 4.8.2 (GCC) warns that 'static int one = 1;' is declared but not used in file net/core/sysctl_net_core.c. Reading the file, that is the case. Attached is a patch to remove it.

Nick

Signature · 3 lines
Gosh that takes me back... or is it forward?  That's the trouble with
time travel, you never can tell."
		-- Doctor Who "Androids of Tara"
net/core/sysctl_net_core.c renamed from net/core/sysctl_net_core.c.orig +0 -1
@@ -23,7 +23,6 @@
 #include <net/pkt_sched.h>
 
 static int zero = 0;
-static int one = 1;
 static int ushort_max = USHRT_MAX;
 static int min_sndbuf = SOCK_MIN_SNDBUF;
 static int min_rcvbuf = SOCK_MIN_RCVBUF;
#1 lore raw
Quoted 2 lines · Nick Warne

gcc version 4.8.2 (GCC) warns that 'static int one = 1;' is declared but not used in file net/core/sysctl_net_core.c.

Only when CONFIG_NET isn't set.

Quoted 2 lines

Reading the file, that is
the case. Attached is a patch to remove it.

$ git grep -w -n one net/core/sysctl_net_core.c
net/core/sysctl_net_core.c:26:static int one = 1;
net/core/sysctl_net_core.c:332:         .extra2         = &one
Quoted 1 line

Please use grep to augment reading.

author
#2 lore raw
Quoted 5 lines · Joe Perches
Quoted 2 lines · Nick Warne

gcc version 4.8.2 (GCC) warns that 'static int one = 1;' is declared but not used in file net/core/sysctl_net_core.c.

Only when CONFIG_NET isn't set.

CONFIG_NET=y

Peculiar indeed.

Quoted 10 lines
Quoted 2 lines

Reading the file, that is
the case. Attached is a patch to remove it.

$ git grep -w -n one net/core/sysctl_net_core.c
net/core/sysctl_net_core.c:26:static int one = 1;
net/core/sysctl_net_core.c:332:         .extra2         = &one
Quoted 1 line

Please use grep to augment reading.

grep -w -n one net/core/sysctl_net_core.c
26:static int one = 1;

?

I just don't have the &one.

I am confused now.

Nick

Signature · 3 lines
Gosh that takes me back... or is it forward?  That's the trouble with
time travel, you never can tell."
		-- Doctor Who "Androids of Tara"

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#4 lore raw
Quoted 26 lines · Joe Perches
Quoted 25 lines · Nick Warne
Quoted 5 lines · Joe Perches
Quoted 2 lines · Nick Warne

gcc version 4.8.2 (GCC) warns that 'static int one = 1;' is declared but not used in file net/core/sysctl_net_core.c.

Only when CONFIG_NET isn't set.

CONFIG_NET=y

Peculiar indeed.

Quoted 10 lines
Quoted 2 lines

Reading the file, that is
the case. Attached is a patch to remove it.

$ git grep -w -n one net/core/sysctl_net_core.c
net/core/sysctl_net_core.c:26:static int one = 1;
net/core/sysctl_net_core.c:332:         .extra2         = &one
Quoted 1 line

Please use grep to augment reading.

grep -w -n one net/core/sysctl_net_core.c
26:static int one = 1;

Quoted 7 lines
Quoted 5 lines

?

I just don't have the &one.

I am confused now.

What source tree are you using?

Latest longterm 3.18.21

Quoted 1 line

What changes in what branch exist?

I am not using git (if that is what you mean by 'branches') - just tarballs from kernel.org

Quoted 5 lines

btw: please use scripts/get_maintainer.pl to better determine who should be cc'd on your patches.

you left out netdev.

Sorry, my bad, I need to learn/read more.

Thanks for your help/advice :)

Nick

Signature · 3 lines
Gosh that takes me back... or is it forward?  That's the trouble with
time travel, you never can tell."
		-- Doctor Who "Androids of Tara"
#5 lore raw
Quoted 29 lines · Nick Warne
Quoted 28 lines · Joe Perches
Quoted 27 lines · Nick Warne
Quoted 5 lines · Joe Perches
Quoted 2 lines · Nick Warne

gcc version 4.8.2 (GCC) warns that 'static int one = 1;' is declared but not used in file net/core/sysctl_net_core.c.

Only when CONFIG_NET isn't set.

CONFIG_NET=y

Peculiar indeed.

Quoted 10 lines
Quoted 2 lines

Reading the file, that is
the case. Attached is a patch to remove it.

$ git grep -w -n one net/core/sysctl_net_core.c
net/core/sysctl_net_core.c:26:static int one = 1;
net/core/sysctl_net_core.c:332:         .extra2         = &one
Quoted 1 line

Please use grep to augment reading.

grep -w -n one net/core/sysctl_net_core.c
26:static int one = 1;

?

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

I just don't have the &one.

I am confused now.

What source tree are you using?

Latest longterm 3.18.21

OK, it's important to mention that otherwise the assumption would be a git tree like net or net-next.

Quoted 4 lines
Quoted 1 line

What changes in what branch exist?

I am not using git (if that is what you mean by 'branches') - just tarballs from kernel.org

(OK, using git and linux-stable)

$ git grep -w -n one v3.18.21 -- net/core/sysctl_net_core.c
v3.18.21:net/core/sysctl_net_core.c:26:static int one = 1;

And the responsible commit:

commit c48cf4f27d4555a455c3fef71137bd0fc44d1656
("net: sysctl_net_core: check SNDBUF and RCVBUF for min length")

author
#6 lore raw
Quoted 48 lines · Joe Perches
Quoted 29 lines · Nick Warne
Quoted 28 lines · Joe Perches
Quoted 27 lines · Nick Warne
Quoted 5 lines · Joe Perches
Quoted 2 lines · Nick Warne

gcc version 4.8.2 (GCC) warns that 'static int one = 1;' is declared but not used in file net/core/sysctl_net_core.c.

Only when CONFIG_NET isn't set.

CONFIG_NET=y

Peculiar indeed.

Quoted 10 lines
Quoted 2 lines

Reading the file, that is
the case. Attached is a patch to remove it.

$ git grep -w -n one net/core/sysctl_net_core.c
net/core/sysctl_net_core.c:26:static int one = 1;
net/core/sysctl_net_core.c:332:         .extra2         = &one
Quoted 1 line

Please use grep to augment reading.

grep -w -n one net/core/sysctl_net_core.c
26:static int one = 1;

?

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

I just don't have the &one.

I am confused now.

What source tree are you using?

Latest longterm 3.18.21

OK, it's important to mention that otherwise the assumption would be a git tree like net or net-next.

Quoted 4 lines
Quoted 1 line

What changes in what branch exist?

I am not using git (if that is what you mean by 'branches') - just tarballs from kernel.org

(OK, using git and linux-stable)

Quoted 7 lines
$ git grep -w -n one v3.18.21 -- net/core/sysctl_net_core.c
v3.18.21:net/core/sysctl_net_core.c:26:static int one = 1;

And the responsible commit:

commit c48cf4f27d4555a455c3fef71137bd0fc44d1656
("net: sysctl_net_core: check SNDBUF and RCVBUF for min length")

Ah, OK. GCC was right - just the variable declaration was overlooked to be removed too.

http://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/?id=c48cf4f27d4555a455c3fef71137bd0fc44d1656

My patch was right then (but wrong) :)

Thanks Joe,

Nick

Signature · 3 lines
Gosh that takes me back... or is it forward?  That's the trouble with
time travel, you never can tell."
		-- Doctor Who "Androids of Tara"