tree: https://github.com/HabanaAI/linux.git habanalabs-fixes head: 3a5e2fb31a2173b4ac9452009019c4d999a84744 commit: 4fdf88733ace4960aeea805f4f3213891691d9f4 [11/13] habanalabs: validate FW file size config: arc-randconfig-r026-20200811 (attached as .config) compiler: arc-elf-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 git checkout 4fdf88733ace4960aeea805f4f3213891691d9f4 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): In file included from include/linux/device.h:15, from include/linux/cdev.h:8, from drivers/misc/habanalabs/common/habanalabs.h:15, from drivers/misc/habanalabs/common/firmware_if.c:8: drivers/misc/habanalabs/common/firmware_if.c: In function 'hl_fw_load_fw_to_device': >> drivers/misc/habanalabs/common/firmware_if.c:54:4: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Wformat=] 54 | "FW file size %lu exceeds maximum of %u bytes\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:53:3: note: in expansion of macro 'dev_err' 53 | dev_err(hdev->dev, | ^~~~~~~ drivers/misc/habanalabs/common/firmware_if.c:54:20: note: format string is defined here 54 | "FW file size %lu exceeds maximum of %u bytes\n", | ~~^ | | | long unsigned int | %u vim +54 drivers/misc/habanalabs/common/firmware_if.c 15 16 #define FW_FILE_MAX_SIZE 0x1400000 /* maximum size of 20MB */ 17 /** 18 * hl_fw_load_fw_to_device() - Load F/W code to device's memory. 19 * 20 * @hdev: pointer to hl_device structure. 21 * @fw_name: the firmware image name 22 * @dst: IO memory mapped address space to copy firmware to 23 * 24 * Copy fw code from firmware file to device memory. 25 * 26 * Return: 0 on success, non-zero for failure. 27 */ 28 int hl_fw_load_fw_to_device(struct hl_device *hdev, const char *fw_name, 29 void __iomem *dst) 30 { 31 const struct firmware *fw; 32 const u64 *fw_data; 33 size_t fw_size; 34 int rc; 35 36 rc = request_firmware(&fw, fw_name, hdev->dev); 37 if (rc) { 38 dev_err(hdev->dev, "Firmware file %s is not found!\n", fw_name); 39 goto out; 40 } 41 42 fw_size = fw->size; 43 if ((fw_size % 4) != 0) { 44 dev_err(hdev->dev, "Illegal %s firmware size %zu\n", 45 fw_name, fw_size); 46 rc = -EINVAL; 47 goto out; 48 } 49 50 dev_dbg(hdev->dev, "%s firmware size == %zu\n", fw_name, fw_size); 51 52 if (fw_size > FW_FILE_MAX_SIZE) { 53 dev_err(hdev->dev, > 54 "FW file size %lu exceeds maximum of %u bytes\n", 55 fw_size, FW_FILE_MAX_SIZE); 56 rc = -EINVAL; 57 goto out; 58 } 59 60 fw_data = (const u64 *) fw->data; 61 62 memcpy_toio(dst, fw_data, fw_size); 63 64 out: 65 release_firmware(fw); 66 return rc; 67 } 68 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org