From: Joerg Roedel Date: Tue, 16 Jun 2009 10:23:58 +0000 (+0200) Subject: dma-debug: fix off-by-one error in overlap function X-Git-Tag: v2.6.31-rc3~31^2~4^2~1 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=c79ee4e466dd12347f112e2af306dca35198458f;p=karo-tx-linux.git dma-debug: fix off-by-one error in overlap function 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. Cc: stable@kernel.org Reported-by: Andrew Randrianasulu Signed-off-by: Joerg Roedel --- diff --git a/lib/dma-debug.c b/lib/dma-debug.c index 3b93129a968c..a9b6b5c9e091 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c @@ -862,7 +862,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)