Cleanup issues reported by scan-build
authorSteven Barth <steven@midlink.org>
Tue, 14 Apr 2015 06:45:26 +0000 (08:45 +0200)
committerSteven Barth <steven@midlink.org>
Tue, 14 Apr 2015 06:45:26 +0000 (08:45 +0200)
Signed-off-by: Steven Barth <steven@midlink.org>
system-linux.c
ubus.c
utils.h

index 2b52cea73bd368f83622c854759af85f6f1966dd..a6734a4bed7b39a8680f521d7ae850dc2398a3c6 100644 (file)
@@ -374,7 +374,6 @@ static int system_get_neigh6reachabletime(struct device *dev, char *buf, const s
 static int cb_rtnl_event(struct nl_msg *msg, void *arg)
 {
        struct nlmsghdr *nh = nlmsg_hdr(msg);
-       struct ifinfomsg *ifi = NLMSG_DATA(nh);
        struct nlattr *nla[__IFLA_MAX];
        int link_state = 0;
        char buf[10];
@@ -382,7 +381,7 @@ static int cb_rtnl_event(struct nl_msg *msg, void *arg)
        if (nh->nlmsg_type != RTM_NEWLINK)
                goto out;
 
-       nlmsg_parse(nh, sizeof(*ifi), nla, __IFLA_MAX - 1, NULL);
+       nlmsg_parse(nh, sizeof(struct ifinfomsg), nla, __IFLA_MAX - 1, NULL);
        if (!nla[IFLA_IFNAME])
                goto out;
 
diff --git a/ubus.c b/ubus.c
index 161fbe777af9148cbff895111dcd443fbf15d188..422b652250a38c3b8fe813ae74c6f4a3a6c33fd3 100644 (file)
--- a/ubus.c
+++ b/ubus.c
@@ -687,7 +687,7 @@ netifd_dump_status(struct interface *iface)
                blobmsg_add_string(&b, "proto", iface->proto_handler->name);
 
        dev = iface->main_dev.dev;
-       if (dev && !dev->hidden &&
+       if (dev && !dev->hidden && iface->proto_handler &&
            !(iface->proto_handler->flags & PROTO_FLAG_NODEV))
                blobmsg_add_string(&b, "device", dev->ifname);
 
diff --git a/utils.h b/utils.h
index 7973b6fb3e3920b3598e02b94c9cf836ca2b391e..301a0753f086baa97834f8fc57d70c96c67069aa 100644 (file)
--- a/utils.h
+++ b/utils.h
@@ -99,7 +99,7 @@ static inline int fls(int x)
         r -= 2;
     }
     if (!(x & 0x80000000u)) {
-        x <<= 1;
+        //x <<= 1;
         r -= 1;
     }
     return r;