Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4627207imb; Wed, 6 Mar 2019 19:00:24 -0800 (PST) X-Google-Smtp-Source: APXvYqxRTu0h44JW7j0ZkwD/XJ7BHcepuH0fEva6oQc1R//oQrup3ouMeF8MnQnp49uTiQIbwe4k X-Received: by 2002:a62:4754:: with SMTP id u81mr10667816pfa.66.1551927624837; Wed, 06 Mar 2019 19:00:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551927624; cv=none; d=google.com; s=arc-20160816; b=kvmlX0s+VtrSxBs4zD84NrxmgjSgePoPA3VRVgxDlL3bW+s8AVdb9u2R/ksbKINOCE gLLaDx/O9W+TzUu188kvkGrZuSZyChR84kqfyHGM8DzoyRu2zUJlQMcB5XaDVW3DAZkP o/BqLQfUGMBsXnsY2CfkMBdwTO2Bou3GF+89vlMrslat3O7Y4R9krd7nTNo4rUNuwUQe hkM6vhgWVbLvC5RfjY2+biRvpwzac3JaiqcMkjGWzpE9Ts6Z6fhhX1eGTIDwMok6DfWf Rc9ux882SRf3G55wWWvs6ifu9h4eEQW2jLIGWCDg10GUXj2k8FPEJpBg8964lstW4pmF qQfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:message-id :in-reply-to:subject:cc:to:from:date; bh=mmjVeFZ0hvByzv4eyhorKhG6oOT1F+a28/GpFCP59B4=; b=rsFZIQ4Hf5KueNyJjiza5wpF00K9aLRXduTcmjH/A3xbaPYlccTCuw48YfO+ILl+Ds Uy65P9JwYrdCEK+rHwhpm1mctgcEpkp4v4rjrcw7lGLMgl5g5dzciQW4xFHY2iKiyV+Z YWMze91e/CKCUnI23XIyUhN1or6L7rHjdux02FWlrtHpVRui1+29V2DCgDhpOLzLYAEx Qd7HdYDgs+jDN65bhKK+qjyCPzrKKyOu59tU0hzc23F3oIGB1mBiOw4hcyI536X2HYWL frSvxXrb4EjuLjBmI5ypPz87mmjv3/zQMefTQ4FU02d+MWD3+XGdUxIdP/J4V8DeQgIG JYOg== 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 x64si3205991pfx.156.2019.03.06.18.59.53; Wed, 06 Mar 2019 19:00:24 -0800 (PST) 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 S1727524AbfCGC7U (ORCPT + 99 others); Wed, 6 Mar 2019 21:59:20 -0500 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:33066 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727507AbfCGC7T (ORCPT ); Wed, 6 Mar 2019 21:59:19 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by kvm5.telegraphics.com.au (Postfix) with ESMTP id 6250929E5B; Wed, 6 Mar 2019 21:59:16 -0500 (EST) Date: Thu, 7 Mar 2019 13:59:33 +1100 (AEDT) From: Finn Thain To: Andreas Schwab cc: Geert Uytterhoeven , kbuild test robot , kbuild-all@01.org, linux-m68k , Arnd Bergmann , Linux Kernel Mailing List Subject: Re: [m68k:master 1174/1174] arch/m68k/include/asm/string.h:72:25: warning: '__builtin_memcpy' forming offset 8 is out of the bounds [0, 7] In-Reply-To: Message-ID: References: <201903042049.npxcZzps%fengguang.wu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 5 Mar 2019, Andreas Schwab wrote: > On Mar 05 2019, Finn Thain wrote: > > > interesting that the kernel's strlen implementation in > > include/linux/string.h can't achieve this. > > This implementation is only available if ARCH_HAS_FORTIFY_SOURCE. > I see. Perhaps we could add another definition to that file: #if !defined(__NO_FORTIFY) && defined(__OPTIMIZE__) && defined(CONFIG_FORTIFY_SOURCE) ... #else __FORTIFY_INLINE __kernel_size_t strlen(const char *p) { return __builtin_strlen(p); } #endif I didn't test that. But the following patch seems to work... diff --git a/arch/m68k/include/asm/string.h b/arch/m68k/include/asm/string.h index f759d944c449..3cff6b128ed3 100644 --- a/arch/m68k/include/asm/string.h +++ b/arch/m68k/include/asm/string.h @@ -71,4 +71,6 @@ extern void *memset(void *, int, __kernel_size_t); extern void *memcpy(void *, const void *, __kernel_size_t); #define memcpy(d, s, n) __builtin_memcpy(d, s, n) +#define strlen(s) __builtin_strlen(s) + #endif /* _M68K_STRING_H_ */ diff --git a/lib/string.c b/lib/string.c index 38e4ca08e757..fe970f2160e5 100644 --- a/lib/string.c +++ b/lib/string.c @@ -472,6 +472,7 @@ char *strim(char *s) EXPORT_SYMBOL(strim); #ifndef __HAVE_ARCH_STRLEN +#undef strlen /** * strlen - Find the length of a string * @s: The string to be sized -- > Andreas. > >