All of lore.kernel.org
 help / color / mirror / Atom feed
* [ogabbay:next 15/21] drivers/misc/habanalabs/common/firmware_if.c:1424:4: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'}
@ 2021-05-04 16:52 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-05-04 16:52 UTC (permalink / raw)
  To: kbuild-all

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux.git next
head:   3c8637e23590d39ff69d8bef998c71d361c3ae95
commit: 47bd5c6d3178737e4ce9d0781063848c9ca116b6 [15/21] habanalabs: load boot fit to device
config: arm-randconfig-r003-20210504 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
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
        # https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux.git/commit/?id=47bd5c6d3178737e4ce9d0781063848c9ca116b6
        git remote add ogabbay https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux.git
        git fetch --no-tags ogabbay next
        git checkout 47bd5c6d3178737e4ce9d0781063848c9ca116b6
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=arm 

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 >>):

   In file included from include/linux/device.h:15,
                    from include/linux/dma-mapping.h:7,
                    from include/linux/skbuff.h:31,
                    from include/linux/if_ether.h:19,
                    from drivers/misc/habanalabs/common/../include/common/cpucp_if.h:12,
                    from drivers/misc/habanalabs/common/habanalabs.h:11,
                    from drivers/misc/habanalabs/common/firmware_if.c:8:
   drivers/misc/habanalabs/common/firmware_if.c: In function 'hl_fw_dynamic_validate_descriptor':
>> drivers/misc/habanalabs/common/firmware_if.c:1424:4: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
    1424 |    "Invalid descriptor size 0x%x, expected size 0x%lx\n",
         |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
      19 | #define dev_fmt(fmt) fmt
         |                      ^~~
   drivers/misc/habanalabs/common/firmware_if.c:1423:3: note: in expansion of macro 'dev_err'
    1423 |   dev_err(hdev->dev,
         |   ^~~~~~~
   drivers/misc/habanalabs/common/firmware_if.c:1424:53: note: format string is defined here
    1424 |    "Invalid descriptor size 0x%x, expected size 0x%lx\n",
         |                                                   ~~^
         |                                                     |
         |                                                     long unsigned int
         |                                                   %x


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

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

---
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: 27058 bytes --]

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

only message in thread, other threads:[~2021-05-04 16:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-04 16:52 [ogabbay:next 15/21] drivers/misc/habanalabs/common/firmware_if.c:1424:4: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 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.