Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp871920ybt; Fri, 19 Jun 2020 16:29:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsH+utrai8b6n6A2I3j+p1xeyDOby/XieHTHgLC/WX1Os44+Zn35AWTu+ZNZbpV4ty5sws X-Received: by 2002:a17:906:17c8:: with SMTP id u8mr5862363eje.129.1592609347104; Fri, 19 Jun 2020 16:29:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592609347; cv=none; d=google.com; s=arc-20160816; b=VDM7dYJC8/lT/n0nMmNEgvRO511KlEIOomk2vVdFU+4uWC94UuBMcI4nzxFsjaFMZu 0hjN5s9x9Ljch2rf73U0PEF0WzZgB3YLvf6Bz8RaaMBJqQnTqZELl5M7k8Y/vaurECVi zsD5vBx0yX8BxcO6EfWdU9XVEx1r/aHlJTYr+sbKNLcpmR5aeYySQjV6SwBqK65N+Tfz G+X0Q+6P3s5Y0b8pNCt9TRiYEzaUj60HGgq3G3+ZMHK6nRGk1Q6UTd5wHzG0byDU0SNX RDLUtHWuBpbzJHD/ASRDleGLcN0s80imbDtUpH3fXfgIbTBl0D/4cUIkDfW7hmGrK1HD 0+4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KFyV0bITQIn8V+4+edG9go8HNcaGfy+nslmANNfwwuU=; b=gyF4S+QzXzxyQNCaiudt1iELcMXgi/K/SziFxb3jNFlvUTyx3UDfXFqy8as2IMH+wg 94UfJUWg1cuYg7QvFF+HdT+n80Szmg7f4MttjhZmOkJOLWq1zX6ASoMoehyP2ylbsq+t QVQSUOeU3+OXGtD9m0W33cWmytHRSPLcbNAbQ+QCmMciUiqfoRy602hbyRH2GggJ36Uz 7M1vy+EpaFp7tzdUOMt+WKeFatmh0nmuhQONNLesI2RifyKzSHBNIvebkztJ59sRJaym 7ji/PZufppKs0Y9S4wNpKrTbgtg8l8s3X8Z4StikocTsETApRIm4M9eDEy1K9aaoTsSF hZ5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lZAJOpoi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id vr3si4538449ejb.520.2020.06.19.16.28.45; Fri, 19 Jun 2020 16:29:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lZAJOpoi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404042AbgFSP2H (ORCPT + 99 others); Fri, 19 Jun 2020 11:28:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:58884 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404401AbgFSP1K (ORCPT ); Fri, 19 Jun 2020 11:27:10 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A6EDC21582; Fri, 19 Jun 2020 15:27:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592580429; bh=V3MnRuuz7AkVJDRxqE0QST2YbXIz7es6hOmB/PD7LhA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lZAJOpoiW44K4uHF8cZImncUnr8RMENbdtLb4bmsiA7UOiTrskiEm+9Pedu77lLLA UlDoBpZ1ID2xZufBJLnmGo/YidgmoI0YYDkU1ptBwJEq8Fcuh2VThN5jk1vxCTiG4e +3YWBGInK9wwdjyIycs8kkhDRSNtKr4Y+3svj2io= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ben Hutchings , YunQiang Su , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.7 215/376] MIPS: Fix exception handler memcpy() Date: Fri, 19 Jun 2020 16:32:13 +0200 Message-Id: <20200619141720.509212248@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141710.350494719@linuxfoundation.org> References: <20200619141710.350494719@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ben Hutchings [ Upstream commit f39293fd37fff74c531b7a52d0459cc77db85e7f ] The exception handler subroutines are declared as a single char, but when copied to the required addresses the copy length is 0x80. When range checks are enabled for memcpy() this results in a build failure, with error messages such as: In file included from arch/mips/mti-malta/malta-init.c:15: In function 'memcpy', inlined from 'mips_nmi_setup' at arch/mips/mti-malta/malta-init.c:98:2: include/linux/string.h:376:4: error: call to '__read_overflow2' declared with attribute error: detected read beyond size of object passed as 2nd parameter 376 | __read_overflow2(); | ^~~~~~~~~~~~~~~~~~ Change the declarations to use type char[]. Signed-off-by: Ben Hutchings Signed-off-by: YunQiang Su Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin --- arch/mips/loongson2ef/common/init.c | 4 ++-- arch/mips/loongson64/init.c | 4 ++-- arch/mips/mti-malta/malta-init.c | 8 ++++---- arch/mips/pistachio/init.c | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/mips/loongson2ef/common/init.c b/arch/mips/loongson2ef/common/init.c index 45512178be77..ce3f02f75e2a 100644 --- a/arch/mips/loongson2ef/common/init.c +++ b/arch/mips/loongson2ef/common/init.c @@ -19,10 +19,10 @@ unsigned long __maybe_unused _loongson_addrwincfg_base; static void __init mips_nmi_setup(void) { void *base; - extern char except_vec_nmi; + extern char except_vec_nmi[]; base = (void *)(CAC_BASE + 0x380); - memcpy(base, &except_vec_nmi, 0x80); + memcpy(base, except_vec_nmi, 0x80); flush_icache_range((unsigned long)base, (unsigned long)base + 0x80); } diff --git a/arch/mips/loongson64/init.c b/arch/mips/loongson64/init.c index da38944471f4..86c5e93258ce 100644 --- a/arch/mips/loongson64/init.c +++ b/arch/mips/loongson64/init.c @@ -17,10 +17,10 @@ static void __init mips_nmi_setup(void) { void *base; - extern char except_vec_nmi; + extern char except_vec_nmi[]; base = (void *)(CAC_BASE + 0x380); - memcpy(base, &except_vec_nmi, 0x80); + memcpy(base, except_vec_nmi, 0x80); flush_icache_range((unsigned long)base, (unsigned long)base + 0x80); } diff --git a/arch/mips/mti-malta/malta-init.c b/arch/mips/mti-malta/malta-init.c index ff2c1d809538..893af377aacc 100644 --- a/arch/mips/mti-malta/malta-init.c +++ b/arch/mips/mti-malta/malta-init.c @@ -90,24 +90,24 @@ static void __init console_config(void) static void __init mips_nmi_setup(void) { void *base; - extern char except_vec_nmi; + extern char except_vec_nmi[]; base = cpu_has_veic ? (void *)(CAC_BASE + 0xa80) : (void *)(CAC_BASE + 0x380); - memcpy(base, &except_vec_nmi, 0x80); + memcpy(base, except_vec_nmi, 0x80); flush_icache_range((unsigned long)base, (unsigned long)base + 0x80); } static void __init mips_ejtag_setup(void) { void *base; - extern char except_vec_ejtag_debug; + extern char except_vec_ejtag_debug[]; base = cpu_has_veic ? (void *)(CAC_BASE + 0xa00) : (void *)(CAC_BASE + 0x300); - memcpy(base, &except_vec_ejtag_debug, 0x80); + memcpy(base, except_vec_ejtag_debug, 0x80); flush_icache_range((unsigned long)base, (unsigned long)base + 0x80); } diff --git a/arch/mips/pistachio/init.c b/arch/mips/pistachio/init.c index a09a5da38e6b..558995ed6fe8 100644 --- a/arch/mips/pistachio/init.c +++ b/arch/mips/pistachio/init.c @@ -83,12 +83,12 @@ phys_addr_t mips_cdmm_phys_base(void) static void __init mips_nmi_setup(void) { void *base; - extern char except_vec_nmi; + extern char except_vec_nmi[]; base = cpu_has_veic ? (void *)(CAC_BASE + 0xa80) : (void *)(CAC_BASE + 0x380); - memcpy(base, &except_vec_nmi, 0x80); + memcpy(base, except_vec_nmi, 0x80); flush_icache_range((unsigned long)base, (unsigned long)base + 0x80); } @@ -96,12 +96,12 @@ static void __init mips_nmi_setup(void) static void __init mips_ejtag_setup(void) { void *base; - extern char except_vec_ejtag_debug; + extern char except_vec_ejtag_debug[]; base = cpu_has_veic ? (void *)(CAC_BASE + 0xa00) : (void *)(CAC_BASE + 0x300); - memcpy(base, &except_vec_ejtag_debug, 0x80); + memcpy(base, except_vec_ejtag_debug, 0x80); flush_icache_range((unsigned long)base, (unsigned long)base + 0x80); } -- 2.25.1