From: Phil Sutter <phil@nwl.cc> Date: 2017-08-17 17:14:01
This series collects patches from v1 which deal with dead code, either
by removing it or changing context so it is accessed again if that makes
sense.
No changes to the actual patches, just splitting into smaller series.
Phil Sutter (7):
devlink: No need for this self-assignment
ipntable: No need to check and assign to parms_rta
iproute: Fix for missing 'Oifs:' display
lib/rt_names: Drop dead code in rtnl_rttable_n2a()
ss: Skip useless check in parse_hostcond()
ss: Drop useless assignment
tc/m_gact: Drop dead code
devlink/devlink.c | 2 +-
ip/ipntable.c | 2 --
ip/iproute.c | 8 +++++---
lib/rt_names.c | 4 ----
misc/ss.c | 3 +--
tc/m_gact.c | 14 +++-----------
6 files changed, 10 insertions(+), 23 deletions(-)
--
2.13.1
From: Phil Sutter <phil@nwl.cc> Date: 2017-08-17 17:10:02
After '*b = *a', 'b->next' already has the same value as 'a->next'.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
misc/ss.c | 1 -
1 file changed, 1 deletion(-)
From: Phil Sutter <phil@nwl.cc> Date: 2017-08-17 17:10:39
Covscan complained about dead code but after reading it, I assume the
author's intention was to prefix the interface list with 'Oifs: '.
Initializing first to 1 and setting it to 0 after above prefix was
printed should fix it.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
ip/iproute.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
From: Phil Sutter <phil@nwl.cc> Date: 2017-08-17 17:10:52
dl_argv_handle_both() will either assign to handle_bit or error out in
which case the variable is not used by the caller.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
devlink/devlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Phil Sutter <phil@nwl.cc> Date: 2017-08-17 17:11:42
The passed 'addr' parameter is dereferenced by caller before and in
parse_hostcond() multiple times before this check, so assume it is
always true.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
misc/ss.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -1671,7 +1671,7 @@ void *parse_hostcond(char *addr, bool is_port)}}}-if(!is_port&&addr&&*addr&&*addr!='*'){+if(!is_port&&*addr&&*addr!='*'){if(get_prefix_1(&a.addr,addr,fam)){if(get_dns_host(&a,addr,fam)){fprintf(stderr,"Error: an inet prefix is expected rather than \"%s\".\n",addr);
From: Phil Sutter <phil@nwl.cc> Date: 2017-08-17 17:11:55
The use of 'ok' variable in parse_gact() is ineffective: The second
conditional increments it either if *argv is 'gact' or if
parse_action_control() doesn't fail (in which case exit() is called).
So this is effectively an unconditional increment and since no decrement
happens anywhere, all remaining checks for 'ok != 0' can be dropped.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
tc/m_gact.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
From: Phil Sutter <phil@nwl.cc> Date: 2017-08-17 17:12:14
This variable is initialized at declaration and nowhere else does any
assignment to it happen, so just drop the check.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
ip/ipntable.c | 2 --
1 file changed, 2 deletions(-)
@@ -202,8 +202,6 @@ static int ipntable_modify(int cmd, int flags, int argc, char **argv)if(get_u32(&queue,*argv,0))invarg("\"queue\" value is invalid",*argv);-if(!parms_rta)-parms_rta=(structrtattr*)&parms_buf;rta_addattr32(parms_rta,sizeof(parms_buf),NDTPA_QUEUE_LEN,queue);parms_change=1;
From: Phil Sutter <phil@nwl.cc> Date: 2017-08-17 17:13:35
Since 'id' is 32bit unsigned, it can never exceed RT_TABLE_MAX (which is
defined to 0xFFFFFFFF). Therefore drop that never matching conditional.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
lib/rt_names.c | 4 ----
1 file changed, 4 deletions(-)
From: Phil Sutter <phil@nwl.cc> Date: 2017-08-18 10:20:25
On Thu, Aug 17, 2017 at 09:48:50PM +0200, Jiri Pirko wrote:
Thu, Aug 17, 2017 at 07:09:25PM CEST, phil@nwl.cc wrote:
quoted
dl_argv_handle_both() will either assign to handle_bit or error out in
which case the variable is not used by the caller.
I'm pretty sure that I did this to silence the compiler. If the compiler
bug is fixed now, good.
That might depend on the compiler you used, so maybe you just want to
give it a try in your environment? If it still happens, we can keep this
self-assignment of course since it shouldn't harm.
Thanks, Phil
Fri, Aug 18, 2017 at 12:20:24PM CEST, phil@nwl.cc wrote:
On Thu, Aug 17, 2017 at 09:48:50PM +0200, Jiri Pirko wrote:
quoted
Thu, Aug 17, 2017 at 07:09:25PM CEST, phil@nwl.cc wrote:
quoted
dl_argv_handle_both() will either assign to handle_bit or error out in
which case the variable is not used by the caller.
I'm pretty sure that I did this to silence the compiler. If the compiler
bug is fixed now, good.
That might depend on the compiler you used, so maybe you just want to
give it a try in your environment? If it still happens, we can keep this
self-assignment of course since it shouldn't harm.
From: Stephen Hemminger <stephen@networkplumber.org> Date: 2017-08-22 00:14:03
On Thu, 17 Aug 2017 19:09:24 +0200
Phil Sutter [off-list ref] wrote:
This series collects patches from v1 which deal with dead code, either
by removing it or changing context so it is accessed again if that makes
sense.
No changes to the actual patches, just splitting into smaller series.
Phil Sutter (7):
devlink: No need for this self-assignment
ipntable: No need to check and assign to parms_rta
iproute: Fix for missing 'Oifs:' display
lib/rt_names: Drop dead code in rtnl_rttable_n2a()
ss: Skip useless check in parse_hostcond()
ss: Drop useless assignment
tc/m_gact: Drop dead code
devlink/devlink.c | 2 +-
ip/ipntable.c | 2 --
ip/iproute.c | 8 +++++---
lib/rt_names.c | 4 ----
misc/ss.c | 3 +--
tc/m_gact.c | 14 +++-----------
6 files changed, 10 insertions(+), 23 deletions(-)