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 f0fd636..0d64d0f 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++;
        }