smatch: nouveau: bogus compare against zero

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

 



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
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux