From: Marc Kleine-Budde mkl@pengutronix.de
mainline inclusion from mainline-v5.4-rc1 commit 6625a18e9ff6462ff81f740a331899b69ad6033e category: feature bugzilla: 38684 CVE: NA
---------------------------
This patch gives the variables holding the CAN receiver and the receiver list a better name by renaming them from "r to "rcv" and "rl" to "recv_list".
Signed-off-by: Oleksij Rempel o.rempel@pengutronix.de Acked-by: Oliver Hartkopp socketcan@hartkopp.net Signed-off-by: Marc Kleine-Budde mkl@pengutronix.de
Conflicts: net/can/af_can.c
Signed-off-by: Zhang Changzhong zhangchangzhong@huawei.com Reviewed-by: YueHaibing yuehaibing@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- net/can/af_can.c | 100 +++++++++++++++++++++++------------------------ 1 file changed, 50 insertions(+), 50 deletions(-)
diff --git a/net/can/af_can.c b/net/can/af_can.c index de229956a613..e1ec048ca9ec 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c @@ -464,8 +464,8 @@ int can_rx_register(struct net *net, struct net_device *dev, canid_t can_id, canid_t mask, void (*func)(struct sk_buff *, void *), void *data, char *ident, struct sock *sk) { - struct receiver *r; - struct hlist_head *rl; + struct receiver *rcv; + struct hlist_head *rcv_list; struct can_dev_rcv_lists *dev_rcv_lists; struct s_pstats *rcv_lists_stats = net->can.can_pstats; int err = 0; @@ -478,32 +478,32 @@ int can_rx_register(struct net *net, struct net_device *dev, canid_t can_id, if (dev && !net_eq(net, dev_net(dev))) return -ENODEV;
- r = kmem_cache_alloc(rcv_cache, GFP_KERNEL); - if (!r) + rcv = kmem_cache_alloc(rcv_cache, GFP_KERNEL); + if (!rcv) return -ENOMEM;
spin_lock(&net->can.can_rcvlists_lock);
dev_rcv_lists = can_dev_rcv_lists_find(net, dev); if (dev_rcv_lists) { - rl = can_rcv_list_find(&can_id, &mask, dev_rcv_lists); + rcv_list = can_rcv_list_find(&can_id, &mask, dev_rcv_lists);
- r->can_id = can_id; - r->mask = mask; - r->matches = 0; - r->func = func; - r->data = data; - r->ident = ident; - r->sk = sk; + rcv->can_id = can_id; + rcv->mask = mask; + rcv->matches = 0; + rcv->func = func; + rcv->data = data; + rcv->ident = ident; + rcv->sk = sk;
- hlist_add_head_rcu(&r->list, rl); + hlist_add_head_rcu(&rcv->list, rcv_list); dev_rcv_lists->entries++;
rcv_lists_stats->rcv_entries++; if (rcv_lists_stats->rcv_entries_max < rcv_lists_stats->rcv_entries) rcv_lists_stats->rcv_entries_max = rcv_lists_stats->rcv_entries; } else { - kmem_cache_free(rcv_cache, r); + kmem_cache_free(rcv_cache, rcv); err = -ENODEV; }
@@ -518,10 +518,10 @@ EXPORT_SYMBOL(can_rx_register); */ static void can_rx_delete_receiver(struct rcu_head *rp) { - struct receiver *r = container_of(rp, struct receiver, rcu); - struct sock *sk = r->sk; + struct receiver *rcv = container_of(rp, struct receiver, rcu); + struct sock *sk = rcv->sk;
- kmem_cache_free(rcv_cache, r); + kmem_cache_free(rcv_cache, rcv); if (sk) sock_put(sk); } @@ -541,8 +541,8 @@ void can_rx_unregister(struct net *net, struct net_device *dev, canid_t can_id, canid_t mask, void (*func)(struct sk_buff *, void *), void *data) { - struct receiver *r = NULL; - struct hlist_head *rl; + struct receiver *rcv = NULL; + struct hlist_head *rcv_list; struct s_pstats *rcv_lists_stats = net->can.can_pstats; struct can_dev_rcv_lists *dev_rcv_lists;
@@ -562,7 +562,7 @@ void can_rx_unregister(struct net *net, struct net_device *dev, canid_t can_id, goto out; }
- rl = can_rcv_list_find(&can_id, &mask, dev_rcv_lists); + rcv_list = can_rcv_list_find(&can_id, &mask, dev_rcv_lists);
/* * Search the receiver list for the item to delete. This should @@ -570,24 +570,24 @@ void can_rx_unregister(struct net *net, struct net_device *dev, canid_t can_id, * been registered before. */
- hlist_for_each_entry_rcu(r, rl, list) { - if (r->can_id == can_id && r->mask == mask && - r->func == func && r->data == data) + hlist_for_each_entry_rcu(rcv, rcv_list, list) { + if (rcv->can_id == can_id && rcv->mask == mask && + rcv->func == func && rcv->data == data) break; }
/* * Check for bugs in CAN protocol implementations using af_can.c: - * 'r' will be NULL if no matching list item was found for removal. + * 'rcv' will be NULL if no matching list item was found for removal. */
- if (!r) { + if (!rcv) { WARN(1, "BUG: receive list entry not found for dev %s, " "id %03X, mask %03X\n", DNAME(dev), can_id, mask); goto out; }
- hlist_del_rcu(&r->list); + hlist_del_rcu(&rcv->list); dev_rcv_lists->entries--;
if (rcv_lists_stats->rcv_entries > 0) @@ -603,23 +603,23 @@ void can_rx_unregister(struct net *net, struct net_device *dev, canid_t can_id, spin_unlock(&net->can.can_rcvlists_lock);
/* schedule the receiver item for deletion */ - if (r) { - if (r->sk) - sock_hold(r->sk); - call_rcu(&r->rcu, can_rx_delete_receiver); + if (rcv) { + if (rcv->sk) + sock_hold(rcv->sk); + call_rcu(&rcv->rcu, can_rx_delete_receiver); } } EXPORT_SYMBOL(can_rx_unregister);
-static inline void deliver(struct sk_buff *skb, struct receiver *r) +static inline void deliver(struct sk_buff *skb, struct receiver *rcv) { - r->func(skb, r->data); - r->matches++; + rcv->func(skb, rcv->data); + rcv->matches++; }
static int can_rcv_filter(struct can_dev_rcv_lists *dev_rcv_lists, struct sk_buff *skb) { - struct receiver *r; + struct receiver *rcv; int matches = 0; struct can_frame *cf = (struct can_frame *)skb->data; canid_t can_id = cf->can_id; @@ -629,9 +629,9 @@ static int can_rcv_filter(struct can_dev_rcv_lists *dev_rcv_lists, struct sk_buf
if (can_id & CAN_ERR_FLAG) { /* check for error message frame entries only */ - hlist_for_each_entry_rcu(r, &dev_rcv_lists->rx[RX_ERR], list) { - if (can_id & r->mask) { - deliver(skb, r); + hlist_for_each_entry_rcu(rcv, &dev_rcv_lists->rx[RX_ERR], list) { + if (can_id & rcv->mask) { + deliver(skb, rcv); matches++; } } @@ -639,23 +639,23 @@ static int can_rcv_filter(struct can_dev_rcv_lists *dev_rcv_lists, struct sk_buf }
/* check for unfiltered entries */ - hlist_for_each_entry_rcu(r, &dev_rcv_lists->rx[RX_ALL], list) { - deliver(skb, r); + hlist_for_each_entry_rcu(rcv, &dev_rcv_lists->rx[RX_ALL], list) { + deliver(skb, rcv); matches++; }
/* check for can_id/mask entries */ - hlist_for_each_entry_rcu(r, &dev_rcv_lists->rx[RX_FIL], list) { - if ((can_id & r->mask) == r->can_id) { - deliver(skb, r); + hlist_for_each_entry_rcu(rcv, &dev_rcv_lists->rx[RX_FIL], list) { + if ((can_id & rcv->mask) == rcv->can_id) { + deliver(skb, rcv); matches++; } }
/* check for inverted can_id/mask entries */ - hlist_for_each_entry_rcu(r, &dev_rcv_lists->rx[RX_INV], list) { - if ((can_id & r->mask) != r->can_id) { - deliver(skb, r); + hlist_for_each_entry_rcu(rcv, &dev_rcv_lists->rx[RX_INV], list) { + if ((can_id & rcv->mask) != rcv->can_id) { + deliver(skb, rcv); matches++; } } @@ -665,16 +665,16 @@ static int can_rcv_filter(struct can_dev_rcv_lists *dev_rcv_lists, struct sk_buf return matches;
if (can_id & CAN_EFF_FLAG) { - hlist_for_each_entry_rcu(r, &dev_rcv_lists->rx_eff[effhash(can_id)], list) { - if (r->can_id == can_id) { - deliver(skb, r); + hlist_for_each_entry_rcu(rcv, &dev_rcv_lists->rx_eff[effhash(can_id)], list) { + if (rcv->can_id == can_id) { + deliver(skb, rcv); matches++; } } } else { can_id &= CAN_SFF_MASK; - hlist_for_each_entry_rcu(r, &dev_rcv_lists->rx_sff[can_id], list) { - deliver(skb, r); + hlist_for_each_entry_rcu(rcv, &dev_rcv_lists->rx_sff[can_id], list) { + deliver(skb, rcv); matches++; } }