Re: [PATCH net v2] mctp i2c: handle NULL header address

From: kernel test robot
Date: Tue Oct 22 2024 - 05:54:19 EST


Hi Matt,

kernel test robot noticed the following build warnings:

[auto build test WARNING on cb560795c8c2ceca1d36a95f0d1b2eafc4074e37]

url: https://github.com/intel-lab-lkp/linux/commits/Matt-Johnston/mctp-i2c-handle-NULL-header-address/20241021-123741
base: cb560795c8c2ceca1d36a95f0d1b2eafc4074e37
patch link: https://lore.kernel.org/r/20241021-mctp-i2c-null-dest-v2-1-4503e478517c%40codeconstruct.com.au
patch subject: [PATCH net v2] mctp i2c: handle NULL header address
config: alpha-randconfig-r122-20241022 (https://download.01.org/0day-ci/archive/20241022/202410221734.IWc5paM1-lkp@xxxxxxxxx/config)
compiler: alpha-linux-gcc (GCC) 13.3.0
reproduce: (https://download.01.org/0day-ci/archive/20241022/202410221734.IWc5paM1-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/202410221734.IWc5paM1-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> drivers/net/mctp/mctp-i2c.c:599:23: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned char [assigned] [usertype] llsrc @@ got unsigned char const *dev_addr @@
drivers/net/mctp/mctp-i2c.c:599:23: sparse: expected unsigned char [assigned] [usertype] llsrc
drivers/net/mctp/mctp-i2c.c:599:23: sparse: got unsigned char const *dev_addr
drivers/net/mctp/mctp-i2c.c: note: in included file (through include/linux/module.h):
include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true
include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true

vim +599 drivers/net/mctp/mctp-i2c.c

579
580 static int mctp_i2c_header_create(struct sk_buff *skb, struct net_device *dev,
581 unsigned short type, const void *daddr,
582 const void *saddr, unsigned int len)
583 {
584 struct mctp_i2c_hdr *hdr;
585 struct mctp_hdr *mhdr;
586 u8 lldst, llsrc;
587
588 if (len > MCTP_I2C_MAXMTU)
589 return -EMSGSIZE;
590
591 if (daddr)
592 lldst = *((u8 *)daddr);
593 else
594 return -EINVAL;
595
596 if (saddr)
597 llsrc = *((u8 *)saddr);
598 else
> 599 llsrc = dev->dev_addr;
600
601 skb_push(skb, sizeof(struct mctp_i2c_hdr));
602 skb_reset_mac_header(skb);
603 hdr = (void *)skb_mac_header(skb);
604 mhdr = mctp_hdr(skb);
605 hdr->dest_slave = (lldst << 1) & 0xff;
606 hdr->command = MCTP_I2C_COMMANDCODE;
607 hdr->byte_count = len + 1;
608 hdr->source_slave = ((llsrc << 1) & 0xff) | 0x01;
609 mhdr->ver = 0x01;
610
611 return sizeof(struct mctp_i2c_hdr);
612 }
613

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