All of lore.kernel.org
 help / color / mirror / Atom feed
* [ogabbay:next 19/27] drivers/misc/habanalabs/common/firmware_if.c:1429:28: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int')
@ 2021-05-06 12:10 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-05-06 12:10 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 5231 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux.git next
head:   1ee64913f1785db2ad8117cb97d148c1dc631028
commit: 652c4625574003ed89fec0544efa646c204012c3 [19/27] habanalabs: load boot fit to device
config: powerpc64-randconfig-r034-20210506 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8f5a2a5836cc8e4c1def2bdeb022e7b496623439)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install powerpc64 cross compiling tool for clang build
        # apt-get install binutils-powerpc64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux.git/commit/?id=652c4625574003ed89fec0544efa646c204012c3
        git remote add ogabbay https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux.git
        git fetch --no-tags ogabbay next
        git checkout 652c4625574003ed89fec0544efa646c204012c3
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=powerpc64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/misc/habanalabs/common/firmware_if.c:1429:28: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
                                           fw_desc->header.size, data_size);
                                                                 ^~~~~~~~~
   include/linux/dev_printk.h:112:32: note: expanded from macro 'dev_err'
           _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
                                 ~~~     ^~~~~~~~~~~
   1 warning generated.


vim +1429 drivers/misc/habanalabs/common/firmware_if.c

  1383	
  1384	/**
  1385	 * hl_fw_dynamic_validate_descriptor - validate FW descriptor
  1386	 *
  1387	 * @hdev: pointer to the habanalabs device structure
  1388	 * @fw_loader: managing structure for loading device's FW
  1389	 * @fw_desc: the descriptor form FW
  1390	 *
  1391	 * @return 0 on success, otherwise non-zero error code
  1392	 */
  1393	static int hl_fw_dynamic_validate_descriptor(struct hl_device *hdev,
  1394						struct fw_load_mgr *fw_loader,
  1395						struct lkd_fw_comms_desc *fw_desc)
  1396	{
  1397		struct pci_mem_region *region;
  1398		enum pci_region region_id;
  1399		size_t data_size;
  1400		u32 data_crc32;
  1401		u8 *data_ptr;
  1402		u64 addr;
  1403		int rc;
  1404	
  1405		if (le32_to_cpu(fw_desc->header.magic) != HL_COMMS_DESC_MAGIC) {
  1406			dev_err(hdev->dev, "Invalid magic for dynamic FW descriptor (%x)\n",
  1407					fw_desc->header.magic);
  1408			return -EIO;
  1409		}
  1410	
  1411		if (fw_desc->header.version != HL_COMMS_DESC_VER) {
  1412			dev_err(hdev->dev, "Invalid version for dynamic FW descriptor (%x)\n",
  1413					fw_desc->header.version);
  1414			return -EIO;
  1415		}
  1416	
  1417		/*
  1418		 * calc CRC32 of data without header.
  1419		 * note that no alignment/stride address issues here as all structures
  1420		 * are 64 bit padded
  1421		 */
  1422		data_size = sizeof(struct lkd_fw_comms_desc) -
  1423						sizeof(struct comms_desc_header);
  1424		data_ptr = (u8 *)fw_desc + sizeof(struct comms_desc_header);
  1425	
  1426		if (le16_to_cpu(fw_desc->header.size) != data_size) {
  1427			dev_err(hdev->dev,
  1428				"Invalid descriptor size 0x%x, expected size 0x%lx\n",
> 1429						fw_desc->header.size, data_size);
  1430			return -EIO;
  1431		}
  1432	
  1433		data_crc32 = hl_fw_compat_crc32(data_ptr, data_size);
  1434	
  1435		if (data_crc32 != le32_to_cpu(fw_desc->header.crc32)) {
  1436			dev_err(hdev->dev,
  1437				"CRC32 mismatch for dynamic FW descriptor (%x:%x)\n",
  1438						data_crc32, fw_desc->header.crc32);
  1439			return -EIO;
  1440		}
  1441	
  1442		/* find memory region to which to copy the image */
  1443		addr = le64_to_cpu(fw_desc->img_addr);
  1444		region_id = hl_get_pci_memory_region(hdev, addr);
  1445		if ((region_id != PCI_REGION_SRAM) &&
  1446				((region_id != PCI_REGION_DRAM))) {
  1447			dev_err(hdev->dev,
  1448				"Invalid region to copy FW image address=%llx\n", addr);
  1449			return -EIO;
  1450		}
  1451	
  1452		region = &hdev->pci_mem_region[region_id];
  1453	
  1454		/* store the region for the copy stage */
  1455		fw_loader->dynamic_loader.image_region = region;
  1456	
  1457		/*
  1458		 * here we know that the start address is valid, now make sure that the
  1459		 * image is within region's bounds
  1460		 */
  1461		rc = hl_fw_dynamic_validate_memory_bound(hdev, addr,
  1462						fw_loader->dynamic_loader.fw_image_size,
  1463						region);
  1464		if (rc) {
  1465			dev_err(hdev->dev,
  1466				"invalid mem transfer request for FW image\n");
  1467			return rc;
  1468		}
  1469	
  1470		return 0;
  1471	}
  1472	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 31122 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-06 12:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-06 12:10 [ogabbay:next 19/27] drivers/misc/habanalabs/common/firmware_if.c:1429:28: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.