From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> Date: Mon, 22 May 2017 10:34:11 +0200 Replace the specification of four data structures by pointer dereferences as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> --- net/core/pktgen.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 96947f5d41e4..c89f4ad21187 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -2995,10 +2995,10 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, skb_reset_mac_header(skb); skb_set_network_header(skb, skb->len); - iph = (struct ipv6hdr *) skb_put(skb, sizeof(struct ipv6hdr)); + iph = (struct ipv6hdr *)skb_put(skb, sizeof(*iph)); skb_set_transport_header(skb, skb->len); - udph = (struct udphdr *) skb_put(skb, sizeof(struct udphdr)); + udph = (struct udphdr *)skb_put(skb, sizeof(*udph)); skb_set_queue_mapping(skb, queue_map); skb->priority = pkt_dev->skb_priority; @@ -3678,5 +3678,5 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname) return -EBUSY; } - pkt_dev = kzalloc_node(sizeof(struct pktgen_dev), GFP_KERNEL, node); + pkt_dev = kzalloc_node(sizeof(*pkt_dev), GFP_KERNEL, node); if (!pkt_dev) @@ -3756,6 +3756,5 @@ static int __net_init pktgen_create_thread(int cpu, struct pktgen_net *pn) struct proc_dir_entry *pe; struct task_struct *p; - t = kzalloc_node(sizeof(struct pktgen_thread), GFP_KERNEL, - cpu_to_node(cpu)); + t = kzalloc_node(sizeof(*t), GFP_KERNEL, cpu_to_node(cpu)); if (!t) { -- 2.13.0 -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html