dma-debug: fix off-by-one error in overlap function
authorJoerg Roedel <joerg.roedel@amd.com>
Tue, 16 Jun 2009 10:23:58 +0000 (12:23 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 20 Jul 2009 03:38:51 +0000 (20:38 -0700)
commit c79ee4e466dd12347f112e2af306dca35198458f upstream.

This patch fixes a bug in the overlap function which returned true if
one region ends exactly before the second region begins. This is no
overlap but the function returned true in that case.

Reported-by: Andrew Randrianasulu <randrik@mail.ru>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
lib/dma-debug.c

index 2b165363bd334c223e324c1dd6f204d181e51955..6a4e3d41ad6dff96d2d82edfaa273dc7d396c142 100644 (file)
@@ -599,7 +599,7 @@ static inline bool overlap(void *addr, u64 size, void *start, void *end)
 
        return ((addr >= start && addr < end) ||
                (addr2 >= start && addr2 < end) ||
-               ((addr < start) && (addr2 >= end)));
+               ((addr < start) && (addr2 > end)));
 }
 
 static void check_for_illegal_area(struct device *dev, void *addr, u64 size)