[PATCH] avoid signed vs unsigned comparison in efi_range_is_wc()
authorJesper Juhl <juhl-lkml@dif.dk>
Thu, 16 Jun 2005 22:14:00 +0000 (15:14 -0700)
committerTony Luck <tony.luck@intel.com>
Thu, 16 Jun 2005 23:27:14 +0000 (16:27 -0700)
warning when building with gcc -W :

 include/linux/efi.h: In function `efi_range_is_wc':
 include/linux/efi.h:320: warning: comparison between signed and unsigned

It looks to me like a significantly large 'len' passed in could cause the
loop to never end. Isn't it safer to make 'i' an unsigned long as well?
Like this little patch below (which of course also kills the warning) :

Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
Signed-off-by: Tony Luck <tony.luck@intel.com>
include/linux/efi.h

index 047e7222df7a70caa441a6a8455472d64c2727b4..73781ec165b40a96e92f98c6701daa27393ea3f3 100644 (file)
@@ -315,7 +315,7 @@ extern struct efi_memory_map memmap;
  */
 static inline int efi_range_is_wc(unsigned long start, unsigned long len)
 {
-       int i;
+       unsigned long i;
 
        for (i = 0; i < len; i += (1UL << EFI_PAGE_SHIFT)) {
                unsigned long paddr = __pa(start + i);