* re: net/hsr: Better frame dispatch
@ 2014-07-10 21:00 Dan Carpenter
2014-07-11 16:12 ` Arvid Brodin
2014-07-11 16:21 ` [PATCH net-next] net/hsr: Remove left-over never-true conditional code Arvid Brodin
0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2014-07-10 21:00 UTC (permalink / raw)
To: kernel-janitors
Hello Arvid Brodin,
The patch f266a683a480: "net/hsr: Better frame dispatch" from Jul 4,
2014, leads to the following static checker warning:
net/hsr/hsr_framereg.c:293 hsr_addr_subst_dest()
warn: this array is probably non-NULL. 'node_dst->MacAddressB'
net/hsr/hsr_framereg.c
286 node_dst = find_node_by_AddrA(&port->hsr->node_db, eth_hdr(skb)->h_dest);
287 if (!node_dst) {
288 WARN_ONCE(1, "%s: Unknown node\n", __func__);
289 return;
290 }
291 if (port->type != node_dst->AddrB_port)
292 return;
293 if (!node_dst->MacAddressB) {
^^^^^^^^^^^^^^^^^^^^^^
This test is never true. It could be deleted or replaced.
294 WARN_ONCE(1, "%s: No MacAddressB\n", __func__);
295 return;
296 }
297
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: net/hsr: Better frame dispatch
2014-07-10 21:00 net/hsr: Better frame dispatch Dan Carpenter
@ 2014-07-11 16:12 ` Arvid Brodin
2014-07-11 16:21 ` [PATCH net-next] net/hsr: Remove left-over never-true conditional code Arvid Brodin
1 sibling, 0 replies; 4+ messages in thread
From: Arvid Brodin @ 2014-07-11 16:12 UTC (permalink / raw)
To: kernel-janitors
On 2014-07-10 23:00, Dan Carpenter wrote:
> Hello Arvid Brodin,
>
> The patch f266a683a480: "net/hsr: Better frame dispatch" from Jul 4,
> 2014, leads to the following static checker warning:
>
> net/hsr/hsr_framereg.c:293 hsr_addr_subst_dest()
> warn: this array is probably non-NULL. 'node_dst->MacAddressB'
>
> net/hsr/hsr_framereg.c
> 286 node_dst = find_node_by_AddrA(&port->hsr->node_db, eth_hdr(skb)->h_dest);
> 287 if (!node_dst) {
> 288 WARN_ONCE(1, "%s: Unknown node\n", __func__);
> 289 return;
> 290 }
> 291 if (port->type != node_dst->AddrB_port)
> 292 return;
> 293 if (!node_dst->MacAddressB) {
> ^^^^^^^^^^^^^^^^^^^^^^
> This test is never true. It could be deleted or replaced.
>
> 294 WARN_ONCE(1, "%s: No MacAddressB\n", __func__);
> 295 return;
> 296 }
> 297
>
Yes, this code (the whole if block; lines 293-296) is useless and should be deleted.
Thanks for finding it!
--
Arvid Brodin | Consultant (Linux)
ALTEN | Knarrarnäsgatan 7 | SE-164 40 Kista | Sweden
arvid.brodin@alten.se | www.alten.se/en/
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" 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] 4+ messages in thread
* [PATCH net-next] net/hsr: Remove left-over never-true conditional code.
2014-07-10 21:00 net/hsr: Better frame dispatch Dan Carpenter
2014-07-11 16:12 ` Arvid Brodin
@ 2014-07-11 16:21 ` Arvid Brodin
2014-07-11 22:05 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Arvid Brodin @ 2014-07-11 16:21 UTC (permalink / raw)
To: David Miller; +Cc: Dan Carpenter, kernel-janitors, netdev@vger.kernel.org
MacAddressB is an array (unsigned char MacAddressB[ETH_ALEN]) and is allocated
as a part of *node_dst (which is a struct hsr_node). So the condition is always
false.
Detected by Dan Carpenter.
Signed-off-by: Arvid Brodin <arvid.brodin@alten.se>
---
net/hsr/hsr_framereg.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c
index c709c13..bace124 100644
--- a/net/hsr/hsr_framereg.c
+++ b/net/hsr/hsr_framereg.c
@@ -290,10 +290,6 @@ void hsr_addr_subst_dest(struct hsr_node *node_src, struct sk_buff *skb,
}
if (port->type != node_dst->AddrB_port)
return;
- if (!node_dst->MacAddressB) {
- WARN_ONCE(1, "%s: No MacAddressB\n", __func__);
- return;
- }
ether_addr_copy(eth_hdr(skb)->h_dest, node_dst->MacAddressB);
}
--
1.8.3.2
--
Arvid Brodin | Consultant (Linux)
ALTEN | Knarrarnäsgatan 7 | SE-164 40 Kista | Sweden
arvid.brodin@alten.se | www.alten.se/en/
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" 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 related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net/hsr: Remove left-over never-true conditional code.
2014-07-11 16:21 ` [PATCH net-next] net/hsr: Remove left-over never-true conditional code Arvid Brodin
@ 2014-07-11 22:05 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2014-07-11 22:05 UTC (permalink / raw)
To: arvid.brodin; +Cc: dan.carpenter, kernel-janitors, netdev
From: Arvid Brodin <arvid.brodin@alten.se>
Date: Fri, 11 Jul 2014 18:21:12 +0200
> MacAddressB is an array (unsigned char MacAddressB[ETH_ALEN]) and is allocated
> as a part of *node_dst (which is a struct hsr_node). So the condition is always
> false.
>
> Detected by Dan Carpenter.
>
> Signed-off-by: Arvid Brodin <arvid.brodin@alten.se>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-07-11 22:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-10 21:00 net/hsr: Better frame dispatch Dan Carpenter
2014-07-11 16:12 ` Arvid Brodin
2014-07-11 16:21 ` [PATCH net-next] net/hsr: Remove left-over never-true conditional code Arvid Brodin
2014-07-11 22:05 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox