[kbuild] drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:1292 gfx_v11_0_rlc_backdoor_autoload_copy_ucode() warn: should '1 << id' be a 64 bit type?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[ I sent this mail on May 9 but didn't hear back.  I'm not sure why
  kbuild is sending duplicates but it's probably a good thing.  -dan ]

Hi Alex,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git  master
head:   7e284070abe53d448517b80493863595af4ab5f0
commit: 98bae89647603309ca2a5f172299ecc31c5d2db0 drm/amdgpu/gfx11: remove some register fields that no longer exist
config: arc-randconfig-m031-20220524 (https://download.01.org/0day-ci/archive/20220527/202205271813.mDvYkTtW-lkp@xxxxxxxxx/config )
compiler: arceb-elf-gcc (GCC) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

smatch warnings:
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:1292 gfx_v11_0_rlc_backdoor_autoload_copy_ucode() warn: should '1 << id' be a 64 bit type?

vim +1292 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c

3d879e81f0f9ed Hawking Zhang 2022-04-13  1264  static void gfx_v11_0_rlc_backdoor_autoload_copy_ucode(struct amdgpu_device *adev,
3d879e81f0f9ed Hawking Zhang 2022-04-13  1265  					      SOC21_FIRMWARE_ID id,
3d879e81f0f9ed Hawking Zhang 2022-04-13  1266  			    		      const void *fw_data,
3d879e81f0f9ed Hawking Zhang 2022-04-13  1267  					      uint32_t fw_size,
3d879e81f0f9ed Hawking Zhang 2022-04-13  1268  					      uint32_t *fw_autoload_mask)
3d879e81f0f9ed Hawking Zhang 2022-04-13  1269  {
3d879e81f0f9ed Hawking Zhang 2022-04-13  1270  	uint32_t toc_offset;
3d879e81f0f9ed Hawking Zhang 2022-04-13  1271  	uint32_t toc_fw_size;
3d879e81f0f9ed Hawking Zhang 2022-04-13  1272  	char *ptr = adev->gfx.rlc.rlc_autoload_ptr;
3d879e81f0f9ed Hawking Zhang 2022-04-13  1273  
3d879e81f0f9ed Hawking Zhang 2022-04-13  1274  	if (id <= SOC21_FIRMWARE_ID_INVALID || id >= SOC21_FIRMWARE_ID_MAX)
3d879e81f0f9ed Hawking Zhang 2022-04-13  1275  		return;
3d879e81f0f9ed Hawking Zhang 2022-04-13  1276  
3d879e81f0f9ed Hawking Zhang 2022-04-13  1277  	toc_offset = rlc_autoload_info[id].offset;
3d879e81f0f9ed Hawking Zhang 2022-04-13  1278  	toc_fw_size = rlc_autoload_info[id].size;
3d879e81f0f9ed Hawking Zhang 2022-04-13  1279  
3d879e81f0f9ed Hawking Zhang 2022-04-13  1280  	if (fw_size == 0)
3d879e81f0f9ed Hawking Zhang 2022-04-13  1281  		fw_size = toc_fw_size;
3d879e81f0f9ed Hawking Zhang 2022-04-13  1282  
3d879e81f0f9ed Hawking Zhang 2022-04-13  1283  	if (fw_size > toc_fw_size)
3d879e81f0f9ed Hawking Zhang 2022-04-13  1284  		fw_size = toc_fw_size;
3d879e81f0f9ed Hawking Zhang 2022-04-13  1285  
3d879e81f0f9ed Hawking Zhang 2022-04-13  1286  	memcpy(ptr + toc_offset, fw_data, fw_size);
3d879e81f0f9ed Hawking Zhang 2022-04-13  1287  
3d879e81f0f9ed Hawking Zhang 2022-04-13  1288  	if (fw_size < toc_fw_size)
3d879e81f0f9ed Hawking Zhang 2022-04-13  1289  		memset(ptr + toc_offset + fw_size, 0, toc_fw_size - fw_size);
3d879e81f0f9ed Hawking Zhang 2022-04-13  1290  
3d879e81f0f9ed Hawking Zhang 2022-04-13  1291  	if ((id != SOC21_FIRMWARE_ID_RS64_PFP) && (id != SOC21_FIRMWARE_ID_RS64_ME))
3d879e81f0f9ed Hawking Zhang 2022-04-13 @1292  		*(uint64_t *)fw_autoload_mask |= 1 << id;
                                                                                         ^^^^^^^
"id" can be more than 31 so it needs to BIT_ULL(id) or 1ULL << id.

3d879e81f0f9ed Hawking Zhang 2022-04-13  1293  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp 
_______________________________________________
kbuild mailing list -- kbuild@xxxxxxxxxxxx
To unsubscribe send an email to kbuild-leave@xxxxxxxxxxxx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux