Skip to contentSkip to conversation

warning related fixes

PATCH In review Stephen Hemminger 3 participants 11 messages Jan 10, 2017

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

cover warning related fixes

These are all patches to fix other warnings found while cleaning up netvsc driver.

Stephen Hemminger (7):
flow_dissector: make local function static
vxlan: remove unused variable
socket: make sockfs_setattr static
dcb: validate netlink attribute link
tcp_nv: make tcpnv_get_info static
ipv6: make udpv6_queue_rcv_skb static
fq_codel: fix set never used warning

 drivers/net/vxlan.c       |  3 +--
 net/core/flow_dissector.c |  4 ++--
 net/dcb/dcbnl.c           | 11 +++++++----
 net/ipv4/tcp_nv.c         |  4 ++--
 net/ipv6/udp.c            |  2 +-
 net/sched/sch_fq_codel.c  |  2 --
 net/socket.c              |  2 +-
 7 files changed, 14 insertions(+), 14 deletions(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/7 flow_dissector: make local function static

Fix warning: no previous prototype for ‘skb_flow_get_be16’ Function is only used in this file, make it static.

---
 net/core/flow_dissector.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/flow_dissector.c +2 -2
index fe4e1531976c..1b7673aac59d 100644
@@ -67,8 +67,8 @@ EXPORT_SYMBOL(skb_flow_dissector_init);
  * The function will try to retrieve a be32 entity at
  * offset poff
  */
-__be16 skb_flow_get_be16(const struct sk_buff *skb, int poff, void *data,
-			 int hlen)
+static __be16 skb_flow_get_be16(const struct sk_buff *skb, int poff,
+				void *data, int hlen)
 {
 	__be16 *u, _u;
 
Signature · 1 line
2.11.0
#4 lore raw

PATCH 2/7 vxlan: remove unused variable

In reply to Stephen Hemminger

Fix drivers/net/vxlan.c: In function ‘neigh_reduce’:
warning: variable ‘saddr’ set but not used [-Wunused-but-set-variable]

---
 drivers/net/vxlan.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/vxlan.c +1 -2
index bb70dd5723b5..4147fd6a4837 100644
@@ -1553,7 +1553,7 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb)
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	struct nd_msg *msg;
 	const struct ipv6hdr *iphdr;
-	const struct in6_addr *saddr, *daddr;
+	const struct in6_addr *daddr;
 	struct neighbour *n;
 	struct inet6_dev *in6_dev;
 
@@ -1562,7 +1562,6 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb)
 		goto out;
 
 	iphdr = ipv6_hdr(skb);
-	saddr = &iphdr->saddr;
 	daddr = &iphdr->daddr;
 
 	msg = (struct nd_msg *)skb_transport_header(skb);
Signature · 1 line
2.11.0
#5 lore raw

PATCH 3/7 socket: make sockfs_setattr static

In reply to Stephen Hemminger

Fix warning introduced by commit ead05568c7d5e
("net: core: Add a UID field to struct sock.")

---
 net/socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/socket.c +1 -1
index 3ef02e97ecf3..b7a63d5bc915 100644
@@ -531,7 +531,7 @@ static ssize_t sockfs_listxattr(struct dentry *dentry, char *buffer,
 	return used;
 }
 
-int sockfs_setattr(struct dentry *dentry, struct iattr *iattr)
+static int sockfs_setattr(struct dentry *dentry, struct iattr *iattr)
 {
 	int err = simple_setattr(dentry, iattr);
 
Signature · 1 line
2.11.0
#6 lore raw

PATCH 4/7 dcb: validate netlink attribute link

In reply to Stephen Hemminger

The dcb netlink code was not validating that the IEEE_APP netlink element was correctly formed. Initially discovered because of the warning ‘dcbnl_ieee_app’ defined but not used.
This indicated that the message was not being fully validated.

Compile tested only. Do not have DCB setup.

---
 net/dcb/dcbnl.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
net/dcb/dcbnl.c +7 -4
index 3202d75329b5..52f0f2fc0a51 100644
@@ -178,10 +178,6 @@ static const struct nla_policy dcbnl_ieee_policy[DCB_ATTR_IEEE_MAX + 1] = {
 	[DCB_ATTR_IEEE_QCN_STATS]   = {.len = sizeof(struct ieee_qcn_stats)},
 };
 
-static const struct nla_policy dcbnl_ieee_app[DCB_ATTR_IEEE_APP_MAX + 1] = {
-	[DCB_ATTR_IEEE_APP]	    = {.len = sizeof(struct dcb_app)},
-};
-
 /* DCB number of traffic classes nested attributes. */
 static const struct nla_policy dcbnl_featcfg_nest[DCB_FEATCFG_ATTR_MAX + 1] = {
 	[DCB_FEATCFG_ATTR_ALL]      = {.type = NLA_FLAG},
@@ -1466,8 +1462,15 @@ static int dcbnl_ieee_set(struct net_device *netdev, struct nlmsghdr *nlh,
 
 		nla_for_each_nested(attr, ieee[DCB_ATTR_IEEE_APP_TABLE], rem) {
 			struct dcb_app *app_data;
+
 			if (nla_type(attr) != DCB_ATTR_IEEE_APP)
 				continue;
+
+			if (nla_len(attr) != sizeof(struct dcb_app)) {
+				err = -ERANGE;
+				goto err;
+			}
+
 			app_data = nla_data(attr);
 			if (ops->ieee_setapp)
 				err = ops->ieee_setapp(netdev, app_data);
Signature · 1 line
2.11.0
#7 lore raw

PATCH 5/7 tcp_nv: make tcpnv_get_info static

In reply to Stephen Hemminger

Function only used in this file.

---
 net/ipv4/tcp_nv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/tcp_nv.c +2 -2
index 5de82a8d4d87..0065f44c40c1 100644
@@ -424,8 +424,8 @@ static void tcpnv_acked(struct sock *sk, const struct ack_sample *sample)
 }
 
 /* Extract info for Tcp socket info provided via netlink */
-size_t tcpnv_get_info(struct sock *sk, u32 ext, int *attr,
-		      union tcp_cc_info *info)
+static size_t tcpnv_get_info(struct sock *sk, u32 ext, int *attr,
+			     union tcp_cc_info *info)
 {
 	const struct tcpnv *ca = inet_csk_ca(sk);
 
Signature · 1 line
2.11.0
#9 lore raw

PATCH 6/7 ipv6: make udpv6_queue_rcv_skb static

In reply to Stephen Hemminger

Only called once, and no prototype.

---
 net/ipv6/udp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/udp.c +1 -1
index 4d5c4eee4b3f..2f8ad6477eaf 100644
@@ -555,7 +555,7 @@ void udpv6_encap_enable(void)
 }
 EXPORT_SYMBOL(udpv6_encap_enable);
 
-int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
+static int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
 {
 	struct udp_sock *up = udp_sk(sk);
 	int is_udplite = IS_UDPLITE(sk);
Signature · 1 line
2.11.0
#10 lore raw

PATCH 7/7 fq_codel: fix set never used warning

In reply to Stephen Hemminger

prev_backlog was set in fq_codel_dequeue but never used.

---
 net/sched/sch_fq_codel.c | 2 --
 1 file changed, 2 deletions(-)
net/sched/sch_fq_codel.c +0 -2
index a5ea0e9b6be4..6709c62123ad 100644
@@ -290,7 +290,6 @@ static struct sk_buff *fq_codel_dequeue(struct Qdisc *sch)
 	struct fq_codel_flow *flow;
 	struct list_head *head;
 	u32 prev_drop_count, prev_ecn_mark;
-	unsigned int prev_backlog;
 
 begin:
 	head = &q->new_flows;
@@ -309,7 +308,6 @@ static struct sk_buff *fq_codel_dequeue(struct Qdisc *sch)
 
 	prev_drop_count = q->cstats.drop_count;
 	prev_ecn_mark = q->cstats.ecn_mark;
-	prev_backlog = sch->qstats.backlog;
 
 	skb = codel_dequeue(sch, &sch->qstats.backlog, &q->cparams,
 			    &flow->cvars, &q->cstats, qdisc_pkt_len,
Signature · 1 line
2.11.0
#3 lore raw

Re: [PATCH net-next 1/7] flow_dissector: make local function static

Quoted 9 lines · On Tue, 10 Jan 2017 13:32:01 -0500 (EST) David Miller <[email protected]>…

From: Stephen Hemminger <[email protected]>
Date: Tue, 10 Jan 2017 10:18:10 -0800

Quoted 4 lines

Fix warning: no previous prototype for ‘skb_flow_get_be16’ Function is only used in this file, make it static.

Eric Dumazet already posted a patch which does this.

Yeah it looks like several of these got posted today.

#8 lore raw

Re: [PATCH net-next 5/7] tcp_nv: make tcpnv_get_info static

In reply to Stephen Hemminger
Quoted 26 lines · On 1/10/17, 10:18 AM, "[email protected] on behalf of Stephen…

Function only used in this file.

---
net/ipv4/tcp_nv.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/tcp_nv.c +2 -2
index 5de82a8d4d87..0065f44c40c1 100644
@@ -424,8 +424,8 @@ static void tcpnv_acked(struct sock *sk, const struct
 ack_sample *sample)
 }
 
 /* Extract info for Tcp socket info provided via netlink */
-size_t tcpnv_get_info(struct sock *sk, u32 ext, int *attr,
-		      union tcp_cc_info *info)
+static size_t tcpnv_get_info(struct sock *sk, u32 ext, int *attr,
+			     union tcp_cc_info *info)
 {
 	const struct tcpnv *ca = inet_csk_ca(sk);
Signature · 2 lines
-- 
2.11.0

You should also remove the line:
EXPORT_SYMBOL_GPL(tcpnv_get_info);