Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp915210imc; Mon, 11 Mar 2019 02:16:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqwvrujaTKDdQxAp01Oo100SLvv6LR8Gobz2UP+ETfZLLQL0t0720f1lCaf+5qEmP3yhFQWr X-Received: by 2002:a63:780e:: with SMTP id t14mr11415579pgc.276.1552295762655; Mon, 11 Mar 2019 02:16:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552295762; cv=none; d=google.com; s=arc-20160816; b=gjoLYvRbqOsrOIT9tDgP/XRIUiTwxBy8qfza2dn+urGy3tgnPB4ch1HzRT1O4YszY6 DMrMnNVKMM93nPgO+K/8OS+vi1HmCetQ09S/pOr92eHspLFkwuP9y0bEsYOZuJXUIXXF sKfAV4tfznSxWyO5NIrevVkz7JSTAOihFiBK24XvKwhCHpDa0to9ju1tMu2cAc6YyIji qa0yRoEJiGmtPbTCX27VyCxlMCCKa3+6y//SPJdELE1XspRHgHnStky62TNLb+ppylNd n/daHXqOwUTWrmWGsJ770bIHqRCpp/UiXs5kTMFvCtzvxOTpC+1sKNT/Nd3td36SE6RT M/TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=PuQeRMisIVhGjNz6Qb/iU/T3AY0VkaMTmKCFjo+Ggng=; b=X2FMRxOiDwu08GLmG1EDuTUg3BWDne61DdchdM2xBe+hfASlUFgDIqo/VCeIj5Olmg Yd6jzvcMEpAnQqXA3w+qTfOtxcBmBYipDKSU6uIgFuI32Pcq3faepNCNfx0egXLL8VZG AGUwU9a0QSGM2mB9OrMBaNIH4Mn8aQ1NJalvuFZS5QIe8VkwE/mTr2EVDR4JBJyZHBke FTASd8igYU9nyZTY4UQIQQoxvkSX69UULRX6YD6R8PIP8W3YHk8qXH6iYPcdAe7vXmOb 8OGqN2FypLd//yoURYPZVdbxNYrnHc/056hWUXc0PfsZt30vadlgVdr3FoJhBetI3km2 EY8A== 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 p4si5291226pli.159.2019.03.11.02.15.47; Mon, 11 Mar 2019 02:16:02 -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 S1727065AbfCKJOY (ORCPT + 99 others); Mon, 11 Mar 2019 05:14:24 -0400 Received: from mail-vs1-f65.google.com ([209.85.217.65]:46527 "EHLO mail-vs1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726977AbfCKJOY (ORCPT ); Mon, 11 Mar 2019 05:14:24 -0400 Received: by mail-vs1-f65.google.com with SMTP id b17so2223116vsr.13 for ; Mon, 11 Mar 2019 02:14:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PuQeRMisIVhGjNz6Qb/iU/T3AY0VkaMTmKCFjo+Ggng=; b=aiEgPuIVNpWaQZ5jxq9ZfOYuXYKS8XbuOTzMyYSO2n9vvyYRn3t0/R0WiKQwHK+EXz +kwoLPYex3CNPyoy7gEmmhbLVErOOvFxkD7/pyamb+sk9uz2K4uAOJGtM9T6e6/zrMpA YZjkVd+uo/uh5S10S+f2M/0aTz6EmE5jx14jMLyKMvYHvW+Uqm8SdTXj2SARUNY6UsZo 7nQEs0Ykm6sdPKQkW3y1CYzW9CP3Vc9/m+irv/FBmQquIR3OW+euR03lxDhvV6+/HHBf Sx3fkipiOClL7ohQM5765tb9d4snbZfhyjijA4SrO0sUt1NHq2K0Vxzkf35eEekmB4Vh FpLQ== X-Gm-Message-State: APjAAAW/jjGNGvk1xtEv0u/f1yeSsDhexVq1Yl/poABZHEslabEYBAX0 UtVotcDJuJL0s5gs5cq24UtUFKShN/T9CxGYsEZP1ZIR X-Received: by 2002:a67:8588:: with SMTP id h130mr15401357vsd.11.1552295663204; Mon, 11 Mar 2019 02:14:23 -0700 (PDT) MIME-Version: 1.0 References: <201903042049.npxcZzps%fengguang.wu@intel.com> In-Reply-To: From: Geert Uytterhoeven Date: Mon, 11 Mar 2019 10:14:11 +0100 Message-ID: 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] To: Finn Thain Cc: Andreas Schwab , kbuild test robot , kbuild-all@01.org, linux-m68k , Arnd Bergmann , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Finn, On Thu, Mar 7, 2019 at 10:42 PM Finn Thain wrote: > On Thu, 7 Mar 2019, Geert Uytterhoeven wrote: > > On Thu, Mar 7, 2019 at 3:59 AM Finn Thain wrote: > > > 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. > > I've tested it now, it works too. This may be a better solution than > defining a strlen macro. > > diff --git a/include/linux/string.h b/include/linux/string.h > index 7927b875f80c..ec9c0a206bd3 100644 > --- a/include/linux/string.h > +++ b/include/linux/string.h > @@ -436,6 +436,13 @@ __FORTIFY_INLINE char *strcpy(char *p, const char *q) > return p; > } > > +#else > + > +__FORTIFY_INLINE __kernel_size_t strlen(const char *p) > +{ > + return __builtin_strlen(p); > +} > + > #endif > > /** > > > 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) > > > > Shouldn't you add > > > > #define __HAVE_ARCH_STRLEN > > > > here... > > > > No, the link fails because the compiler still emits some references to > strlen(). Despite -ffreestanding?!? > > > --- 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 > > > > ... so you can drop this change? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds