Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932157AbdHWOY5 (ORCPT ); Wed, 23 Aug 2017 10:24:57 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:49405 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754053AbdHWOY4 (ORCPT ); Wed, 23 Aug 2017 10:24:56 -0400 From: Arnd Bergmann To: Russell King Cc: Ard Biesheuvel , Nicolas Pitre , Nathan Lynch , Mark Rutland , Arnd Bergmann , Will Deacon , Marc Zyngier , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] ARM: vdso: Define vdso_{start,end} as array Date: Wed, 23 Aug 2017 16:23:51 +0200 Message-Id: <20170823142419.1811665-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:pPI6g4fDl93sPtPhjptmK8ArB2QeBIzk9ic1RA/jUMN7NPI7ttl rbc2+MlktZbLiDZKrBj3lSvcKMn8STclopZxRmb2pXM8vOAvKIzI2XbWL/blxAyjVTPhvI6 6zGxdtfrKpkUsBSA6b/4ISJR8+osCmz/misWNK3I+iJsGjzkZqFa0SjDvCbt0EpneD5lZ+F ukqaxVbB2ryxQbo+MA12A== X-UI-Out-Filterresults: notjunk:1;V01:K0:s1rbdrill14=:lTKkOJ0eIz10goEe4U5lIY 137SwUXdPN+KjQJFLAcg78sdYJyh908W7dqs8Dt0ad8S93EQzeeftAHxQfDqanWTfj8bVTxw1 wWAb7dX3a/hME4yAk9JebhHXF9YzmGXnv3nkj9nTTjCP/sTp9JV6A/TeQvDgnEwdGUKBzbS/3 /io3qsBiOKgkqotnmx19gs8STH4BYEYU3kz24zxBanBrn2dYGFlPDKXf/1UlFZT4oeEA7W3UW f57GWRxRzgsv710NJHC5IqGr8LpGaqWxzviWCr6dppaewvP/TGjVHmuA3FKQRSQh8ezacJ5rW uvGW09eh30tgUOMe0Etf+tf4+TlP9e9Z/nIfYgRyGZxrf9s0r6Dn4MW5c8kjacE6fZqOJfQhb qPG0iPJ9+sC9G8rhitmgo7TNZ5sK5LPnKGpajC9l+4649kgmTFl2TEJdktA/k5HHp7Fdt4ayl DCqx9hDIpk1leF7gWafCh4D9xCxNV0+URgQ/hO6fybyR0GALRGT705wL0ALNFypiOCQUZJlek pgezc0CXRp6wAJiNCyZq17jZ7fM+CFo59iAythVBeTJwFld6vPUlCgw9tA05xPC18tAwWqDGs G0gdKJYK1wF6v7NtweozZUlfD6LhEqPbo4Tq6qqpR4Ro7OFYklPy71LvLoFQLvjfQWkoE9r+n ed0Yn2CnpwtETHyvN6ION8DshzBeeqfZpjL6kcLWVrH2w+h3dpzW+hdnX0E/K9MLitKCtM8M2 NSTu+0L9p+oVkdclHPVEq9FItbvdHACId4eHeA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2487 Lines: 77 gcc-8 correctly points out that reading four bytes from a pointer to a 'char' variable is wrong arch/arm/kernel/vdso.c: In function 'vdso_init': arch/arm/kernel/vdso.c:200:6: error: '__builtin_memcmp_eq' reading 4 bytes from a region of size 1 [-Werror=stringop-overflow=] However, in this case the variable just stands for the beginning of the vdso and is not actually a 'char', so the code is doing what it is meant to do. This uses the same approach as arm64 and x86, declaring the addresses as char arrays. See also: dbbb08f500d6 ("arm64, vdso: Define vdso_{start,end} as array") Suggested-by: Mark Rutland Suggested-by: Ard Biesheuvel Signed-off-by: Arnd Bergmann --- arch/arm/include/asm/vdso.h | 2 +- arch/arm/kernel/vdso.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm/include/asm/vdso.h b/arch/arm/include/asm/vdso.h index d0295f1dd1a3..95b7a4dcd6d2 100644 --- a/arch/arm/include/asm/vdso.h +++ b/arch/arm/include/asm/vdso.h @@ -11,7 +11,7 @@ struct mm_struct; void arm_install_vdso(struct mm_struct *mm, unsigned long addr); -extern char vdso_start, vdso_end; +extern char vdso_start[], vdso_end[]; extern unsigned int vdso_total_pages; diff --git a/arch/arm/kernel/vdso.c b/arch/arm/kernel/vdso.c index a4d6dc0f2427..f401b51d06ea 100644 --- a/arch/arm/kernel/vdso.c +++ b/arch/arm/kernel/vdso.c @@ -197,13 +197,13 @@ static int __init vdso_init(void) unsigned int text_pages; int i; - if (memcmp(&vdso_start, "\177ELF", 4)) { + if (memcmp(vdso_start, "\177ELF", 4)) { pr_err("VDSO is not a valid ELF object!\n"); return -ENOEXEC; } - text_pages = (&vdso_end - &vdso_start) >> PAGE_SHIFT; - pr_debug("vdso: %i text pages at base %p\n", text_pages, &vdso_start); + text_pages = (vdso_end - vdso_start) >> PAGE_SHIFT; + pr_debug("vdso: %i text pages at base %p\n", text_pages, vdso_start); /* Allocate the VDSO text pagelist */ vdso_text_pagelist = kcalloc(text_pages, sizeof(struct page *), @@ -218,7 +218,7 @@ static int __init vdso_init(void) for (i = 0; i < text_pages; i++) { struct page *page; - page = virt_to_page(&vdso_start + i * PAGE_SIZE); + page = virt_to_page(vdso_start + i * PAGE_SIZE); vdso_text_pagelist[i] = page; } @@ -229,7 +229,7 @@ static int __init vdso_init(void) cntvct_ok = cntvct_functional(); - patch_vdso(&vdso_start); + patch_vdso(vdso_start); return 0; } -- 2.9.0