Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdgpu: Fix shift type in amdgpu_debugfs_sdma_sched_mask_set()

The "mask" and "val" variables are type u64. The problem is that the
BIT() macros are type unsigned long which is just 32 bits on 32bit
systems.

It's unlikely that people will be using this driver on 32bit kernels
and even if they did we only use the lower AMDGPU_MAX_SDMA_INSTANCES (16)
bits. So this bug does not affect anything in real life.

Still, for correctness sake, u64 bit masks should use BIT_ULL().

Fixes: d2e3961ae371 ("drm/amdgpu: add amdgpu_sdma_sched_mask debugfs")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/d39a9325-87a4-4543-b6ec-1c61fca3a6fc@stanley.mountain
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Dan Carpenter and committed by
Alex Deucher
6ec6cd9a f7e672e6

+2 -2
+2 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
··· 362 362 if (!adev) 363 363 return -ENODEV; 364 364 365 - mask = (1 << adev->sdma.num_instances) - 1; 365 + mask = BIT_ULL(adev->sdma.num_instances) - 1; 366 366 if ((val & mask) == 0) 367 367 return -EINVAL; 368 368 369 369 for (i = 0; i < adev->sdma.num_instances; ++i) { 370 370 ring = &adev->sdma.instance[i].ring; 371 - if (val & (1 << i)) 371 + if (val & BIT_ULL(i)) 372 372 ring->sched.ready = true; 373 373 else 374 374 ring->sched.ready = false;