drivers/net/usb/aqc111.c:623:22: sparse: sparse: incorrect type in assignment (different base types)

From: kernel test robot
Date: Sat Dec 23 2023 - 21:09:29 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 3f82f1c3a03694800a4104ca6b6d3282bd4e213d
commit: 4a3576d2bcc755475890e2db717cab0effb1f140 net: usb: aqc111: Implement TX data path
date: 5 years ago
config: x86_64-randconfig-x001-20230717 (https://download.01.org/0day-ci/archive/20231224/202312241027.pRt8ik6L-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231224/202312241027.pRt8ik6L-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312241027.pRt8ik6L-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> drivers/net/usb/aqc111.c:623:22: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned long long [usertype] @@ got restricted __le64 [usertype] @@
drivers/net/usb/aqc111.c:623:22: sparse: expected unsigned long long [usertype]
drivers/net/usb/aqc111.c:623:22: sparse: got restricted __le64 [usertype]
drivers/net/usb/aqc111.c: note: in included file (through include/linux/textsearch.h, include/linux/skbuff.h, include/linux/if_ether.h, ...):
include/linux/slab.h:332:43: sparse: sparse: dubious: x & !y
drivers/net/usb/aqc111.c:20:12: warning: 'aqc111_read_cmd_nopm' defined but not used [-Wunused-function]
20 | static int aqc111_read_cmd_nopm(struct usbnet *dev, u8 cmd, u16 value,
| ^~~~~~~~~~~~~~~~~~~~

vim +623 drivers/net/usb/aqc111.c

580
581 static struct sk_buff *aqc111_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
582 gfp_t flags)
583 {
584 int frame_size = dev->maxpacket;
585 struct sk_buff *new_skb = NULL;
586 u64 *tx_desc_ptr = NULL;
587 int padding_size = 0;
588 int headroom = 0;
589 int tailroom = 0;
590 u64 tx_desc = 0;
591
592 /*Length of actual data*/
593 tx_desc |= skb->len & AQ_TX_DESC_LEN_MASK;
594
595 headroom = (skb->len + sizeof(tx_desc)) % 8;
596 if (headroom != 0)
597 padding_size = 8 - headroom;
598
599 if (((skb->len + sizeof(tx_desc) + padding_size) % frame_size) == 0) {
600 padding_size += 8;
601 tx_desc |= AQ_TX_DESC_DROP_PADD;
602 }
603
604 if (!dev->can_dma_sg && (dev->net->features & NETIF_F_SG) &&
605 skb_linearize(skb))
606 return NULL;
607
608 headroom = skb_headroom(skb);
609 tailroom = skb_tailroom(skb);
610
611 if (!(headroom >= sizeof(tx_desc) && tailroom >= padding_size)) {
612 new_skb = skb_copy_expand(skb, sizeof(tx_desc),
613 padding_size, flags);
614 dev_kfree_skb_any(skb);
615 skb = new_skb;
616 if (!skb)
617 return NULL;
618 }
619 if (padding_size != 0)
620 skb_put_zero(skb, padding_size);
621 /* Copy TX header */
622 tx_desc_ptr = skb_push(skb, sizeof(tx_desc));
> 623 *tx_desc_ptr = cpu_to_le64(tx_desc);
624
625 usbnet_set_skb_tx_stats(skb, 1, 0);
626
627 return skb;
628 }
629

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki