lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202501081604.SgFiMXxU-lkp@intel.com>
Date: Wed, 8 Jan 2025 16:46:48 +0800
From: kernel test robot <lkp@...el.com>
To: Chengen Du <chengen.du@...onical.com>, pjones@...hat.com
Cc: oe-kbuild-all@...ts.linux.dev, konrad@...nel.org,
	linux-kernel@...r.kernel.org, Chengen Du <chengen.du@...onical.com>
Subject: Re: [PATCH RESEND] iscsi_ibft: Fix UBSAN shift-out-of-bounds warning
 in ibft_attr_show_nic()

Hi Chengen,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.13-rc6 next-20250107]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Chengen-Du/iscsi_ibft-Fix-UBSAN-shift-out-of-bounds-warning-in-ibft_attr_show_nic/20250106-123816
base:   linus/master
patch link:    https://lore.kernel.org/r/20250106043415.1966355-1-chengen.du%40canonical.com
patch subject: [PATCH RESEND] iscsi_ibft: Fix UBSAN shift-out-of-bounds warning in ibft_attr_show_nic()
config: i386-randconfig-061-20250108 (https://download.01.org/0day-ci/archive/20250108/202501081604.SgFiMXxU-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250108/202501081604.SgFiMXxU-lkp@intel.com/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@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501081604.SgFiMXxU-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/firmware/iscsi_ibft.c:314:29: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __be32 [usertype] val @@     got int @@
   drivers/firmware/iscsi_ibft.c:314:29: sparse:     expected restricted __be32 [usertype] val
   drivers/firmware/iscsi_ibft.c:314:29: sparse:     got int

vim +314 drivers/firmware/iscsi_ibft.c

   290	
   291	static ssize_t ibft_attr_show_nic(void *data, int type, char *buf)
   292	{
   293		struct ibft_kobject *entry = data;
   294		struct ibft_nic *nic = entry->nic;
   295		void *ibft_loc = entry->header;
   296		char *str = buf;
   297		__be32 val;
   298	
   299		if (!nic)
   300			return 0;
   301	
   302		switch (type) {
   303		case ISCSI_BOOT_ETH_INDEX:
   304			str += sprintf(str, "%d\n", nic->hdr.index);
   305			break;
   306		case ISCSI_BOOT_ETH_FLAGS:
   307			str += sprintf(str, "%d\n", nic->hdr.flags);
   308			break;
   309		case ISCSI_BOOT_ETH_IP_ADDR:
   310			str += sprintf_ipaddr(str, nic->ip_addr);
   311			break;
   312		case ISCSI_BOOT_ETH_SUBNET_MASK:
   313			if (nic->subnet_mask_prefix > 32)
 > 314				val = ~0;
   315			else
   316				val = cpu_to_be32(~((1 << (32-nic->subnet_mask_prefix))-1));
   317			str += sprintf(str, "%pI4", &val);
   318			break;
   319		case ISCSI_BOOT_ETH_PREFIX_LEN:
   320			str += sprintf(str, "%d\n", nic->subnet_mask_prefix);
   321			break;
   322		case ISCSI_BOOT_ETH_ORIGIN:
   323			str += sprintf(str, "%d\n", nic->origin);
   324			break;
   325		case ISCSI_BOOT_ETH_GATEWAY:
   326			str += sprintf_ipaddr(str, nic->gateway);
   327			break;
   328		case ISCSI_BOOT_ETH_PRIMARY_DNS:
   329			str += sprintf_ipaddr(str, nic->primary_dns);
   330			break;
   331		case ISCSI_BOOT_ETH_SECONDARY_DNS:
   332			str += sprintf_ipaddr(str, nic->secondary_dns);
   333			break;
   334		case ISCSI_BOOT_ETH_DHCP:
   335			str += sprintf_ipaddr(str, nic->dhcp);
   336			break;
   337		case ISCSI_BOOT_ETH_VLAN:
   338			str += sprintf(str, "%d\n", nic->vlan);
   339			break;
   340		case ISCSI_BOOT_ETH_MAC:
   341			str += sprintf(str, "%pM\n", nic->mac);
   342			break;
   343		case ISCSI_BOOT_ETH_HOSTNAME:
   344			str += sprintf_string(str, nic->hostname_len,
   345					      (char *)ibft_loc + nic->hostname_off);
   346			break;
   347		default:
   348			break;
   349		}
   350	
   351		return str - buf;
   352	};
   353	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ