* smatch: nouveau: bogus compare against zero
@ 2010-12-20 6:48 Dan Carpenter
2010-12-21 1:12 ` Ben Skeggs
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-12-20 6:48 UTC (permalink / raw)
To: Ben Skeggs; +Cc: dri-devel
Hi Ben,
This is a new Smatch warning in linux-next. It comes from: a11c3198c
"drm/nv50: import new vm code"
drivers/gpu/drm/nouveau/nv50_vm.c +104 nv50_vm_map(13)
warn: bogus compare against zero: 'i'
94 u32 block, i;
95
96 phys = nv50_vm_addr(vma, pgt, phys, mem->memtype, 0);
97 pte <<= 3;
98 cnt <<= 3;
99
100 while (cnt) {
101 u32 offset_h = upper_32_bits(phys);
102 u32 offset_l = lower_32_bits(phys);
103
104 for (i = 7; i >= 0; i--) {
^^^^^^
i is unsigned so this test is always true.
105 block = 1 << (i + 3);
106 if (cnt >= block && !(pte & (block - 1)))
107 break;
108 }
109 offset_l |= (i << 7);
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: smatch: nouveau: bogus compare against zero
2010-12-20 6:48 smatch: nouveau: bogus compare against zero Dan Carpenter
@ 2010-12-21 1:12 ` Ben Skeggs
0 siblings, 0 replies; 2+ messages in thread
From: Ben Skeggs @ 2010-12-21 1:12 UTC (permalink / raw)
To: Dan Carpenter; +Cc: dri-devel
On Mon, 2010-12-20 at 09:48 +0300, Dan Carpenter wrote:
> Hi Ben,
>
> This is a new Smatch warning in linux-next. It comes from: a11c3198c
> "drm/nv50: import new vm code"
Thanks, fix queued in my tree. Will get to Dave eventually :)
Ben.
>
> drivers/gpu/drm/nouveau/nv50_vm.c +104 nv50_vm_map(13)
> warn: bogus compare against zero: 'i'
>
> 94 u32 block, i;
> 95
> 96 phys = nv50_vm_addr(vma, pgt, phys, mem->memtype, 0);
> 97 pte <<= 3;
> 98 cnt <<= 3;
> 99
> 100 while (cnt) {
> 101 u32 offset_h = upper_32_bits(phys);
> 102 u32 offset_l = lower_32_bits(phys);
> 103
> 104 for (i = 7; i >= 0; i--) {
> ^^^^^^
>
> i is unsigned so this test is always true.
>
> 105 block = 1 << (i + 3);
> 106 if (cnt >= block && !(pte & (block - 1)))
> 107 break;
> 108 }
> 109 offset_l |= (i << 7);
>
> regards,
> dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-12-21 1:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-20 6:48 smatch: nouveau: bogus compare against zero Dan Carpenter
2010-12-21 1:12 ` Ben Skeggs
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.