* [PATCH net-next] bridge: add missing bridge port check for offloads
@ 2015-02-06 6:24 roopa
2015-02-08 6:50 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: roopa @ 2015-02-06 6:24 UTC (permalink / raw)
To: bridge, dan.carpenter, stephen, netdev; +Cc: davem
From: Roopa Prabhu <roopa@cumulusnetworks.com>
This patch fixes a missing bridge port check caught by smatch.
setlink/dellink of attributes like vlans can come for a bridge device
and there is no need to offload those today. So, this patch adds a bridge
port check. (In these cases however, the BRIDGE_SELF flags will always be set
and we may not hit a problem with the current code).
smatch complaint:
The patch 68e331c785b8: "bridge: offload bridge port attributes to
switch asic if feature flag set" from Jan 29, 2015, leads to the
following Smatch complaint:
net/bridge/br_netlink.c:552 br_setlink()
error: we previously assumed 'p' could be null (see line 518)
net/bridge/br_netlink.c
517
518 if (p && protinfo) {
^
Check for NULL.
Reported-By: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
net/bridge/br_netlink.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index b93f42c..4fbcea0 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -543,7 +543,7 @@ int br_setlink(struct net_device *dev, struct nlmsghdr *nlh, u16 flags)
afspec, RTM_SETLINK);
}
- if (!(flags & BRIDGE_FLAGS_SELF)) {
+ if (p && !(flags & BRIDGE_FLAGS_SELF)) {
/* set bridge attributes in hardware if supported
*/
ret_offload = netdev_switch_port_bridge_setlink(dev, nlh,
@@ -583,7 +583,7 @@ int br_dellink(struct net_device *dev, struct nlmsghdr *nlh, u16 flags)
*/
br_ifinfo_notify(RTM_NEWLINK, p);
- if (!(flags & BRIDGE_FLAGS_SELF)) {
+ if (p && !(flags & BRIDGE_FLAGS_SELF)) {
/* del bridge attributes in hardware
*/
ret_offload = netdev_switch_port_bridge_dellink(dev, nlh,
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] bridge: add missing bridge port check for offloads
2015-02-06 6:24 [PATCH net-next] bridge: add missing bridge port check for offloads roopa
@ 2015-02-08 6:50 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-02-08 6:50 UTC (permalink / raw)
To: roopa; +Cc: netdev, bridge, dan.carpenter
From: roopa@cumulusnetworks.com
Date: Thu, 5 Feb 2015 22:24:45 -0800
> From: Roopa Prabhu <roopa@cumulusnetworks.com>
>
> This patch fixes a missing bridge port check caught by smatch.
>
> setlink/dellink of attributes like vlans can come for a bridge device
> and there is no need to offload those today. So, this patch adds a bridge
> port check. (In these cases however, the BRIDGE_SELF flags will always be set
> and we may not hit a problem with the current code).
>
> smatch complaint:
>
> The patch 68e331c785b8: "bridge: offload bridge port attributes to
> switch asic if feature flag set" from Jan 29, 2015, leads to the
> following Smatch complaint:
>
> net/bridge/br_netlink.c:552 br_setlink()
> error: we previously assumed 'p' could be null (see line 518)
>
> net/bridge/br_netlink.c
> 517
> 518 if (p && protinfo) {
> ^
> Check for NULL.
>
> Reported-By: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-08 6:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-06 6:24 [PATCH net-next] bridge: add missing bridge port check for offloads roopa
2015-02-08 6:50 ` David Miller
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).