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: Wed, 29 Jul 2009 22:02:53 +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=/IifyQbe9OEbhMW+mWY/+y90dCf5VRvTppbc0dlE8OU=; b=N1EDxOW8an450ppSKZ4jRhyqh2GTrdGHenYNv8hTUiXyskp6AgDqNXvrFLjYK96hts CQHrAAS0uYxyCqeDrs118PWPJBgcP8PoEDmyX1mtwh6C1Qk2WW41AwckvCDCZBpRuzt2 IJnMVkc9XcePBMaw/m5+rEUofamPxk+8j31I8=
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=d7Rj30yA82WJ1ygEs9YYx4gNjvr4kgpb8MqZWOGg5KR5ymeha8lYDqfEATnVmYYTGu 22aOPZLz7HzUZ/B6la347WbSdLSMBXWbFgZe+rOAmpcvtSYi8rxR7Asmnad8eXVxyPPl 5yIGzAbe3zIpkk2H2Up56gkCGA0lpcxPK7qW8=
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
it should tests against ARRAY_SIZE(psp_var_map) instead of sizeof(psp_var_map)

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
ARRAY_SIZE(psp_var_map) is 9.
sizeof(psp_var_map) is 144.

diff --git a/arch/mips/ar7/prom.c b/arch/mips/ar7/prom.c
index a320bce..5ad6f1d 100644
--- a/arch/mips/ar7/prom.c
+++ b/arch/mips/ar7/prom.c
@@ -144,7 +144,7 @@ static char * __init lookup_psp_var_map(u8 num)
 {
        int i;
 
-       for (i = 0; i < sizeof(psp_var_map); i++)
+       for (i = 0; i < ARRAY_SIZE(psp_var_map); i++)
                if (psp_var_map[i].num == num)
                        return psp_var_map[i].value;
 

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