linux-mips
[Top] [All Lists]

[PATCH] MIPS: Read buffer overflow

To: ralf@linux-mips.org, linux-mips@linux-mips.org, Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] MIPS: Read buffer overflow
From: Roel Kluin <roel.kluin@gmail.com>
Date: Fri, 31 Jul 2009 14:52:51 +0200
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=xLcWIxpHGP4mlurS44zV+ESBzOv9wlZR73KeCRjlGSo=; b=wh7qm5ulB1FjfP4zSYn3GAOAz4+kmbDGcxjtDm/vNBpmhy5zbqZExCMeW5U3rvcp6F ToMc7G5TaGuO5fK4mOsm+ZelgqgqWBEFOqGgWVvXzR7FeYA9LvMtIR0C3WcjMF4pvYEN nij5kH0YR2T5x4K26tJOXX0H2/Yb08z5o5p1k=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=bNlP+VbPKL7lxauMrRJ8D0CfX1au1F8NAZMKthNPa//w1vnpQrJuSMecCm6ZgTYzs4 RpgSwHk7bsUCWyAuLyV3sLI8jqNzjm5C7nzxOpwNcLK3zADpj10e4BQaweEqvEhzYrUG Ps4EuXSOR2op5lkA+zxJq2WrrqZFPjAZPx0Uc=
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Thunderbird/3.0b2
Check whether index is within bounds before testing the element.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/arch/mips/jazz/jazzdma.c b/arch/mips/jazz/jazzdma.c
index f0fd636..0d64d0f 100644
--- a/arch/mips/jazz/jazzdma.c
+++ b/arch/mips/jazz/jazzdma.c
@@ -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++;
        }

<Prev in Thread] Current Thread [Next in Thread>