MIPS: Jazz: Fix read buffer overflow
authorRoel Kluin <roel.kluin@gmail.com>
Fri, 31 Jul 2009 12:52:51 +0000 (14:52 +0200)
committerRalf Baechle <ralf@linux-mips.org>
Mon, 3 Aug 2009 16:52:47 +0000 (17:52 +0100)
Check whether index is within bounds before testing the element.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/jazz/jazzdma.c

index f0fd636723be1d2663e16ada6af9aeab32a225cb..0d64d0f464185c0c9c383fcad2e1d30416afc854 100644 (file)
@@ -190,7 +190,7 @@ int vdma_free(unsigned long laddr)
                return -1;
        }
 
-       while (pgtbl[i].owner == laddr && i < VDMA_PGTBL_ENTRIES) {
+       while (i < VDMA_PGTBL_ENTRIES && pgtbl[i].owner == laddr) {
                pgtbl[i].owner = VDMA_PAGE_EMPTY;
                i++;
        }