netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arp: make arp_hdr_len() return unsigned int
@ 2017-09-26 20:12 Alexey Dobriyan
  2017-09-28 17:29 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Dobriyan @ 2017-09-26 20:12 UTC (permalink / raw)
  To: davem; +Cc: netdev

Negative ARP header length are not a thing.

Constify arguments while I'm at it.

Space savings:

	add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-3 (-3)
	function                        old     new   delta
	arpt_do_table                  1163    1160      -3

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 drivers/net/bonding/bond_main.c |    3 ++-
 include/linux/if_arp.h          |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2491,7 +2491,8 @@ int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond,
 	struct slave *curr_active_slave, *curr_arp_slave;
 	unsigned char *arp_ptr;
 	__be32 sip, tip;
-	int alen, is_arp = skb->protocol == __cpu_to_be16(ETH_P_ARP);
+	int is_arp = skb->protocol == __cpu_to_be16(ETH_P_ARP);
+	unsigned int alen;
 
 	if (!slave_do_arp_validate(bond, slave)) {
 		if ((slave_do_arp_validate_only(bond) && is_arp) ||
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -31,7 +31,7 @@ static inline struct arphdr *arp_hdr(const struct sk_buff *skb)
 	return (struct arphdr *)skb_network_header(skb);
 }
 
-static inline int arp_hdr_len(struct net_device *dev)
+static inline unsigned int arp_hdr_len(const struct net_device *dev)
 {
 	switch (dev->type) {
 #if IS_ENABLED(CONFIG_FIREWIRE_NET)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] arp: make arp_hdr_len() return unsigned int
  2017-09-26 20:12 [PATCH] arp: make arp_hdr_len() return unsigned int Alexey Dobriyan
@ 2017-09-28 17:29 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-09-28 17:29 UTC (permalink / raw)
  To: adobriyan; +Cc: netdev

From: Alexey Dobriyan <adobriyan@gmail.com>
Date: Tue, 26 Sep 2017 23:12:28 +0300

> Negative ARP header length are not a thing.
> 
> Constify arguments while I'm at it.
> 
> Space savings:
> 
> 	add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-3 (-3)
> 	function                        old     new   delta
> 	arpt_do_table                  1163    1160      -3
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-28 17:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-26 20:12 [PATCH] arp: make arp_hdr_len() return unsigned int Alexey Dobriyan
2017-09-28 17:29 ` 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).