Return-Path: Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:58684 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753565AbdL1RNP (ORCPT ); Thu, 28 Dec 2017 12:13:15 -0500 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Chris Metcalf" , "Dan Carpenter" Date: Thu, 28 Dec 2017 16:59:12 +0000 Message-ID: Subject: [PATCH 3.2 01/94] tile: array underflow in setup_maxnodemem() In-Reply-To: Sender: stable-owner@vger.kernel.org List-ID: 3.2.97-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter commit 637f23abca87d26e091e0d6647ec878d97d2c6cd upstream. My static checker correctly complains that we should have a lower bound on "node" to prevent an array underflow. Fixes: 867e359b97c9 ("arch/tile: core support for Tilera 32-bit chips.") Signed-off-by: Dan Carpenter Signed-off-by: Chris Metcalf [bwh: Backported to 3.2: keep maxnodemem_mb as long] Signed-off-by: Ben Hutchings --- --- a/arch/tile/kernel/setup.c +++ b/arch/tile/kernel/setup.c @@ -119,7 +119,8 @@ early_param("maxmem", setup_maxmem); static int __init setup_maxnodemem(char *str) { char *endp; - long maxnodemem_mb, node; + long maxnodemem_mb; + unsigned long node; node = str ? simple_strtoul(str, &endp, 0) : INT_MAX; if (node >= MAX_NUMNODES || *endp != ':' ||