summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorКоренберг Марк (ноутбук дома) <socketpair@gmail.com>2012-09-09 19:33:04 (GMT)
committerКоренберг Марк (дома) <socketpair@gmail.com>2012-10-19 16:32:59 (GMT)
commite1b67fb23f8f802f3b287c66fda531e002ca20d7 (patch)
tree51149c3f29d656b5e510fa69baf160c1fd82149d /lib
parentfedb862ea5a46df327a4de75e613e2d7732e8b46 (diff)
downloadlibnl-e1b67fb23f8f802f3b287c66fda531e002ca20d7.zip
libnl-e1b67fb23f8f802f3b287c66fda531e002ca20d7.tar.gz
libnl-e1b67fb23f8f802f3b287c66fda531e002ca20d7.tar.bz2
Clang diagnostics
Based on clang diagnostics: 1. lib/nl.c: recvmsgs(): nla filling with zeros commented. 2. lib/route/classid.c: & lib/route/pktloc.c: remove zero-filling of struct stat 3. lib/route/qdisc/htb.c: Fix htb_qdisc_msg_fill(): fix zero-filling 4. ematch/container.c: container_parse: commented why only 4 bytes are copied len marked as unused to eliminate compiler warning
Diffstat (limited to 'lib')
-rw-r--r--lib/nl.c6
-rw-r--r--lib/route/classid.c2
-rw-r--r--lib/route/cls/ematch/container.c8
-rw-r--r--lib/route/pktloc.c2
-rw-r--r--lib/route/qdisc/htb.c8
5 files changed, 19 insertions, 7 deletions
diff --git a/lib/nl.c b/lib/nl.c
index 5b37c2a..2fa741f 100644
--- a/lib/nl.c
+++ b/lib/nl.c
@@ -540,6 +540,12 @@ static int recvmsgs(struct nl_sock *sk, struct nl_cb *cb)
int n, err = 0, multipart = 0, interrupted = 0, nrecv = 0;
unsigned char *buf = NULL;
struct nlmsghdr *hdr;
+
+ /*
+ nla is passed on to not only to nl_recv() but may also be passed
+ to a function pointer provided by the caller which may or may not
+ initialize the variable. Thomas Graf.
+ */
struct sockaddr_nl nla = {0};
struct nl_msg *msg = NULL;
struct ucred *creds = NULL;
diff --git a/lib/route/classid.c b/lib/route/classid.c
index a128773..87025a0 100644
--- a/lib/route/classid.c
+++ b/lib/route/classid.c
@@ -311,7 +311,7 @@ static int classid_map_add(uint32_t classid, const char *name)
int rtnl_tc_read_classid_file(void)
{
static time_t last_read;
- struct stat st = {0};
+ struct stat st;
char buf[256], *path;
FILE *fd;
int err;
diff --git a/lib/route/cls/ematch/container.c b/lib/route/cls/ematch/container.c
index ddbdce0..6d73ab6 100644
--- a/lib/route/cls/ematch/container.c
+++ b/lib/route/cls/ematch/container.c
@@ -14,8 +14,14 @@
#include <netlink/netlink.h>
#include <netlink/route/cls/ematch.h>
-static int container_parse(struct rtnl_ematch *e, void *data, size_t len)
+static int container_parse(struct rtnl_ematch *e, void *data, size_t len __attribute__((unused)))
{
+ /*
+ The kernel may provide more than 4 bytes of data in the future and we want
+ older libnl versions to be ok with that. We want interfaces to be growable
+ so we only ever enforce a minimum data length and copy as much as we are
+ aware of. Thomas Graf.
+ */
memcpy(e->e_data, data, sizeof(uint32_t));
return 0;
diff --git a/lib/route/pktloc.c b/lib/route/pktloc.c
index e7dffe5..70d552b 100644
--- a/lib/route/pktloc.c
+++ b/lib/route/pktloc.c
@@ -90,7 +90,7 @@ static int read_pktlocs(void)
YY_BUFFER_STATE buf = NULL;
yyscan_t scanner = NULL;
static time_t last_read;
- struct stat st = {0};
+ struct stat st;
char *path;
int i, err;
FILE *fd;
diff --git a/lib/route/qdisc/htb.c b/lib/route/qdisc/htb.c
index 4298580..9fb0bf6 100644
--- a/lib/route/qdisc/htb.c
+++ b/lib/route/qdisc/htb.c
@@ -190,10 +190,10 @@ static int htb_qdisc_msg_fill(struct rtnl_tc *tc, void *data,
struct nl_msg *msg)
{
struct rtnl_htb_qdisc *htb = data;
- struct tc_htb_glob opts = {0};
-
- opts.version = TC_HTB_PROTOVER;
- opts.rate2quantum = 10;
+ struct tc_htb_glob opts = {
+ .version = TC_HTB_PROTOVER,
+ .rate2quantum = 10,
+ };
if (htb) {
if (htb->qh_mask & SCH_HTB_HAS_RATE2QUANTUM)