Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1054092ybp; Wed, 9 Oct 2019 08:12:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqwkNoSwz2bn3fauvffzPLRpn01MXr30H8/ttGZvPm0UBWdXQn0fFT6BRZOUVDILbOPR8KwW X-Received: by 2002:a17:906:ce2e:: with SMTP id sd14mr3393683ejb.197.1570633954246; Wed, 09 Oct 2019 08:12:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570633954; cv=none; d=google.com; s=arc-20160816; b=w885UrqRS/o8Yqf2AgBEZhVvOTpEWyP0hYY2KsIh6NjBzlTefd5IZxhXGoBNUfHxZ1 9xg6SUii2HA4orIVy0FYk6dewcqvnc6F0WIytYZsGrQjWaGh3FJTuOix3iGxHbQWPsh+ aQQpnccBZjLBv9IQ3LpK1SaRPvVHty+xWWjdvDNu50zhfw9RClVfi/onSdKoReZqdr3s FlJ0yinjNg9HatXtQmrtDn14YILf2haKjYUQW1nPF+nDXC5A0kln4dnRxl3Hqjrhq0hT bHK9DX+AErD++O30hNzw5NoAYvOqfnA5Hcnw8kqVKe2w5owRk74O3ziJ3pTbQ5IudcYF YjzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from; bh=H/ngfeFf1FIVbPEHIJjSe7YIXY2sePLRpH729TyAiOc=; b=Htvc8NNwq4MBrKliepWz38zPF/zJkciVFjxdhBMnd3de0IuxzBvcIK2DyLl9kLiWJq da66EwdxeDeBsHoFZiZKxUlHCcpCRP4ELzwL79SNVmuhVH0SyRuHuk7209M2TmP6gscl 4/Bc3dfNknzHPQ8LAaHuE5Lk1G3SD6m+64JtTB6HEhDSrlSAQyBxWgqjNtk2sJ9HE1wl 5uqhlTQeSjiskEOfqpXM3NDr16igO/2t+IL7DuduTlFLmUdXF/NreS66QaJdSzl7IBCN Gnbuy3u86a5exSHt1lTDam9DvGOdNIB+fv1mJK3WqAUawLgkgzcAHQswPXVxwqR4YNXf /4DA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qn24si1232677ejb.200.2019.10.09.08.12.10; Wed, 09 Oct 2019 08:12:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731602AbfJIPLF (ORCPT + 99 others); Wed, 9 Oct 2019 11:11:05 -0400 Received: from mx2.suse.de ([195.135.220.15]:54086 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731593AbfJIPLF (ORCPT ); Wed, 9 Oct 2019 11:11:05 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D6BBFAD6D; Wed, 9 Oct 2019 15:11:03 +0000 (UTC) From: Thomas Bogendoerfer To: Ralf Baechle , Paul Burton , James Hogan , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] MIPS: fw: sni: Fix out of bounds init of o32 stack Date: Wed, 9 Oct 2019 17:10:56 +0200 Message-Id: <20191009151056.32289-1-tbogendoerfer@suse.de> X-Mailer: git-send-email 2.16.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use ARRAY_SIZE to caluculate the top of the o32 stack. Signed-off-by: Thomas Bogendoerfer --- arch/mips/fw/sni/sniprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/fw/sni/sniprom.c b/arch/mips/fw/sni/sniprom.c index 8772617b64ce..80112f2298b6 100644 --- a/arch/mips/fw/sni/sniprom.c +++ b/arch/mips/fw/sni/sniprom.c @@ -43,7 +43,7 @@ /* O32 stack has to be 8-byte aligned. */ static u64 o32_stk[4096]; -#define O32_STK &o32_stk[sizeof(o32_stk)] +#define O32_STK (&o32_stk[ARRAY_SIZE(o32_stk)]) #define __PROM_O32(fun, arg) fun arg __asm__(#fun); \ __asm__(#fun " = call_o32") -- 2.16.4