Re: [PATCH] drm/amdgpu: potential shift wrapping bug

Dan Carpenter
2017-08-10T12:53:44Z

On Thu, Aug 10, 2017 at 02:30:15PM +0200, Christian König wrote:
> Am 10.08.2017 um 14:16 schrieb Dan Carpenter:
> > "frag_align" is a u64, so presumably we want to use the high bits as
> > well instead of shift wrapping.
> >
> > Fixes: 6be7adb37d9b ("drm/amdgpu: increase fragmentation size for Vega10 v2")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> The fragment field has only 5bits in hardware and can never be more than 31,
> so the correct fix would actually be using uint32_t here instead.
>

Changing it to uint32_t introduces a new static checker warning:

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1465 amdgpu_vm_frag_ptes()
warn: was expecting a 64 bit value instead of '~(frag_align - 1)'

Unfortunately, I get so many thousands of those I can't normally even
review that sort of bug...

Let me resend the original patch but with a modified changelog to say
that the bug is a false positive.

regards,
dan carpenter