linux-mips
[Top] [All Lists]

[PATCH] MIPS: Alchemy: fix unchecked kstrtoul return value

To: Linux-MIPS <linux-mips@linux-mips.org>
Subject: [PATCH] MIPS: Alchemy: fix unchecked kstrtoul return value
From: Manuel Lauss <manuel.lauss@gmail.com>
Date: Thu, 20 Feb 2014 14:37:40 +0100
Cc: Manuel Lauss <manuel.lauss@gmail.com>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=p7gfcSQIjo1jiolpAgs/tkfXLsRmd6bvpZjewg+4/5s=; b=mF2O3XS6mri/o5UYY5re3Yr0aql60i3GcUoPtGgYfy/vdDwrHqr2vLD9vVaIaiFAI5 HOp+YoShW+qJeyq2gzI7uWR6hm39GX3eJv82gq+SQZDn+Gxpu5aG5ycHa0n6e19kH54G iSxqKEyuGbFOhEMgq2NAcx/bgNPHyqsVhh6MqQkPlYjzgVQqvJk+uMv5m+N+j2v/mxtw z9QFkwwdsxyCJ/LjKTsOXKQDGu2oggR8vh69cDjALK52kYJtVsVni4CrUUA6cB00Fu2v ZpCHvjs5soFTd7IjI5EFNwMMcYAsVQIk2E/nJYpDRwu9gAdFJfOrVSs6yco1b7qpEuNu oG0Q==
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
enabled __must_check logic triggers a build error for mtx1 and gpr
in the prom init code.  Fix by checking the kstrtoul() return value.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
---
 arch/mips/alchemy/board-gpr.c  | 4 +---
 arch/mips/alchemy/board-mtx1.c | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/mips/alchemy/board-gpr.c b/arch/mips/alchemy/board-gpr.c
index 9edc35f..acf9a2a 100644
--- a/arch/mips/alchemy/board-gpr.c
+++ b/arch/mips/alchemy/board-gpr.c
@@ -53,10 +53,8 @@ void __init prom_init(void)
        prom_init_cmdline();
 
        memsize_str = prom_getenv("memsize");
-       if (!memsize_str)
+       if (!memsize_str || kstrtoul(memsize_str, 0, &memsize))
                memsize = 0x04000000;
-       else
-               strict_strtoul(memsize_str, 0, &memsize);
        add_memory_region(0, memsize, BOOT_MEM_RAM);
 }
 
diff --git a/arch/mips/alchemy/board-mtx1.c b/arch/mips/alchemy/board-mtx1.c
index 9969dba..25a59a2 100644
--- a/arch/mips/alchemy/board-mtx1.c
+++ b/arch/mips/alchemy/board-mtx1.c
@@ -52,10 +52,8 @@ void __init prom_init(void)
        prom_init_cmdline();
 
        memsize_str = prom_getenv("memsize");
-       if (!memsize_str)
+       if (!memsize_str || kstrtoul(memsize_str, 0, &memsize))
                memsize = 0x04000000;
-       else
-               strict_strtoul(memsize_str, 0, &memsize);
        add_memory_region(0, memsize, BOOT_MEM_RAM);
 }
 
-- 
1.8.5.5


<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] MIPS: Alchemy: fix unchecked kstrtoul return value, Manuel Lauss <=