[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Thu, 05 May 2011 11:00:36 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: sasikanth.v19@...il.com
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH] Removed unnecessary assignments , gotos and goto labels
From: Sasikanth V <sasikanth.v19@...il.com>
Date: Sat, 30 Apr 2011 23:53:29 +0530
> @@ -1779,15 +1770,15 @@ static int packet_getname(struct socket *sock, struct sockaddr *uaddr,
> sll->sll_ifindex = po->ifindex;
> sll->sll_protocol = po->num;
> sll->sll_pkttype = 0;
> + sll->sll_hatype = 0;
> + sll->sll_halen = 0;
> +
> rcu_read_lock();
> dev = dev_get_by_index_rcu(sock_net(sk), po->ifindex);
> if (dev) {
> sll->sll_hatype = dev->type;
> sll->sll_halen = dev->addr_len;
> memcpy(sll->sll_addr, dev->dev_addr, dev->addr_len);
> - } else {
> - sll->sll_hatype = 0; /* Bad: we have no ARPHRD_UNSPEC */
> - sll->sll_halen = 0;
> }
> rcu_read_unlock();
This is completely bogus.
In the dev != NULL case, we'll now write to sll_hatype and sll_halen
twice, which is less inefficient than making sure we write to these
fields only one.
And outside of this part, I really don't like the cleanups you made
here, and they don't improve the code in any way in my eyes.
Sorry.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists