Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1460708rdb; Wed, 20 Sep 2023 09:39:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHHHcLpsdM+S6qgm7AJPflOQa73yLlbXr904RGUQaZF+C68XJKJHi3az9Cu3RKPS4EctH7l X-Received: by 2002:a05:6a20:1050:b0:14a:d117:ef97 with SMTP id gt16-20020a056a20105000b0014ad117ef97mr2697628pzc.11.1695227990788; Wed, 20 Sep 2023 09:39:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695227990; cv=none; d=google.com; s=arc-20160816; b=NUf5PsaLJTvjJPaMGuOXTh2qK9FLKAC3a7aSKHiGEwmSpQh43/2ddOmpbRErQgh+Jx H8g0iSLAN8lN+FDoJTUYst7pj+kgUPs66/4+6G7t1EAtMbzRv76cNrtiEFdZJ94sGI6g KIxn0/b7T3cppHjCx1cjQ1LXm3sk5sI6QtQv6PtUjmfJ8w4s953mSyjP+yhLEaPw3Iso nT0uuVkcEVvJMaco5Q87gVIKg1qCF6KGEbgskklpzHyl052a+bA7yxIH3irToX+MPpfv kPlmdlpoEuPLQlT2Acgd+AAdD76xiNOopFZqeF0rfyomKxUKnvaH0kI15m8NReBmIROb 9SvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=H26RPo4SqMH5e9jWbl0Q09O07WYxZnqu9SqAuPO/jy4=; fh=lrQnsgXnFWCuBpQ6rBMHPWs3lvhAVBADYNga6p1TX28=; b=Q9jywUbhUd0EFCrLmvpbvqrvYDoPedUCca8vt/HZr+96m66wHilm4Y9TN3Ylsb7vj7 /x0r4+FiJIWm6tl/uVecqC7S5Lq9uFDaBehExXfqfTVeN6rI/HPPWyC70OR9LyJG9GVt WNOlL/ld7cNS8sxtm/Clae8k2ocpRoNtvQGPzYhM6yub8uzRqbirBxH4s4SGooY2eXWt +8FoyRKj0SMU3Mb4Jatb6qEIVMcy2F0M7ExyYGF57o/A3ie06Qk/tfvHhQ0PEsdAAFvn CFhvzK1qT22s3sJQX1G9pi9Mteoza1aWtBZ6uG1uu2ueeEzBpyKOEzS7/y11Pp3o6r89 xoqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vO3E17pG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id ck10-20020a056a00328a00b0068fea8a6169si11886305pfb.404.2023.09.20.09.39.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 09:39:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vO3E17pG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id EE3C78074C9D; Wed, 20 Sep 2023 09:20:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234463AbjITQUb (ORCPT + 99 others); Wed, 20 Sep 2023 12:20:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234157AbjITQU3 (ORCPT ); Wed, 20 Sep 2023 12:20:29 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C10DAC2 for ; Wed, 20 Sep 2023 09:20:23 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6048EC433CA for ; Wed, 20 Sep 2023 16:20:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695226823; bh=KcR2/qS3SyhnxYdT6WldJOounUSlQTkI4WgTOPbYWSo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=vO3E17pGXsNuUh2QKbJYn57dIww7emTD55aoFS8gdJ0ji09a6pZtWL+V7hHWF0itV eYcGaQnFCTs46D+KBTAg4tdrcLgbJc1gzVdQnHPkSHCPPuCU66DPdeTetds7c5PDh9 dPDEtNIKsUuV05NS31V29xltdBaqcSEBCdBJk0JfHv5UQodaSWuIkLxZNg+xdow6Cp DjEWB315GObPWCFeGVKm3kSTf8srnImwm9QYgd/MuI2z1f3oNEhd0JhHJ/gex/rAvF SKzEVWNz/MENHsk9trFLI+q7nZh3k9+xSfXSxpv2VWFZD+1ryMylsEun4Fn6vemW37 VAx3gnnISW30A== Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-5041bb9ce51so44900e87.1 for ; Wed, 20 Sep 2023 09:20:23 -0700 (PDT) X-Gm-Message-State: AOJu0Yxgdrn9om5JpahBqT4HvqHURSw5LYtSeu6L8oKQxQomNqKWfmBd XjnyKr4P2VTvtnkvhNVWjnLMnuCAy3cCF/UHjA== X-Received: by 2002:a19:654b:0:b0:4ff:7e1e:b4b4 with SMTP id c11-20020a19654b000000b004ff7e1eb4b4mr2590776lfj.39.1695226821304; Wed, 20 Sep 2023 09:20:21 -0700 (PDT) MIME-Version: 1.0 References: <202309192013.vI4DKHmw-lkp@intel.com> <194e2d22-9eff-ec6c-9bc9-13b62bda870a@roeck-us.net> In-Reply-To: <194e2d22-9eff-ec6c-9bc9-13b62bda870a@roeck-us.net> From: Rob Herring Date: Wed, 20 Sep 2023 11:20:07 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: arch/m68k/include/asm/raw_io.h:91:13: warning: array subscript 0 is outside array bounds of 'volatile u16[0]' {aka 'volatile short unsigned int[]'} To: Guenter Roeck Cc: kernel test robot , Geert Uytterhoeven , oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org, Wim Van Sebroeck Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 20 Sep 2023 09:20:35 -0700 (PDT) On Wed, Sep 20, 2023 at 9:30=E2=80=AFAM Guenter Roeck = wrote: > > On 9/20/23 05:44, Rob Herring wrote: > > On Tue, Sep 19, 2023 at 6:14=E2=80=AFPM Guenter Roeck wrote: > >> > >> On 9/19/23 11:37, Rob Herring wrote: > >>> On Tue, Sep 19, 2023 at 7:09=E2=80=AFAM kernel test robot wrote: > >>>> > >>>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin= ux.git master > >>>> head: 2cf0f715623872823a72e451243bbf555d10d032 > >>>> commit: f1a43aadb5a690e141a3b6700e2a40c1d4dbe088 watchdog: Enable CO= MPILE_TEST for more drivers > >>>> date: 5 weeks ago > >>>> config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/2= 0230919/202309192013.vI4DKHmw-lkp@intel.com/config) > >>>> compiler: m68k-linux-gcc (GCC) 13.2.0 > >>>> reproduce (this is a W=3D1 build): (https://download.01.org/0day-ci/= archive/20230919/202309192013.vI4DKHmw-lkp@intel.com/reproduce) > >>>> > >>>> If you fix the issue in a separate patch/commit (i.e. not just a new= version of > >>>> the same patch/commit), kindly add following tags > >>>> | Reported-by: kernel test robot > >>>> | Closes: https://lore.kernel.org/oe-kbuild-all/202309192013.vI4DKHm= w-lkp@intel.com/ > >>>> > >>>> All warnings (new ones prefixed by >>): > >>>> > >>>> In file included from arch/m68k/include/asm/io_mm.h:25, > >>>> from arch/m68k/include/asm/io.h:8, > >>>> from include/linux/io.h:13, > >>>> from drivers/watchdog/machzwd.c:39: > >>>> In function 'zf_set_timer', > >>>> inlined from 'zf_timer_on' at drivers/watchdog/machzwd.c:21= 8:2: > >>>>>> arch/m68k/include/asm/raw_io.h:91:13: warning: array subscript 0 i= s outside array bounds of 'volatile u16[0]' {aka 'volatile short unsigned i= nt[]'} [-Warray-bounds=3D] > >>>> 91 | __w =3D ((*(__force volatile u16 *) ((_addr & 0= xFFFF0000UL) + ((__v >> 8)<<1)))); \ > >>>> | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >>>> arch/m68k/include/asm/io_mm.h:228:20: note: in expansion of mac= ro 'rom_out_le16' > >>>> 228 | : rom_out_le16(isa_itw(port), (val))) > >>>> | ^~~~~~~~~~~~ > >>>> arch/m68k/include/asm/io_mm.h:356:42: note: in expansion of mac= ro 'isa_rom_outw' > >>>> 356 | #define outw(val, port) ((port) < 1024 ? isa_rom_outw((= val), (port)) : out_le16((port), (val))) > >>>> | ^~~~~~~~~~~~ > >>>> drivers/watchdog/machzwd.c:74:53: note: in expansion of macro '= outw' > >>>> 74 | #define zf_writew(port, data) { outb(port, INDEX); out= w(data, DATA_W); } > >>>> | ^~~= ~ > >>>> drivers/watchdog/machzwd.c:173:17: note: in expansion of macro = 'zf_writew' > >>>> 173 | zf_writew(COUNTER_1, new); > >>>> | ^~~~~~~~~ > >>>> In function 'zf_timer_on': > >>>> cc1: note: source object is likely at address zero > >>> > >>> This seems to be some newish check in gcc which looks for fixed > >>> pointers below 4KB[1]. The linked issue says more was planned for > >>> gcc-13, but I haven't found what that is. AFAICT, that shouldn't > >>> happen with this config because isa_itw() should be variable and the > >>> compiler shouldn't be able to determine the value of _addr. However, = a > >>> config with CONFIG_Q40=3Dn, CONFIG_AMIGA_PCMCIA=3Dn, and > >>> CONFIG_ATARI_ROM_ISA=3Dn would have a fixed NULL value and could trig= ger > >>> the warning. This should also have warnings everywhere outw() (and > >>> others) are used with a constant port value. > >>> > >>> Rob > >>> > >>> [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99578 > >> > >> A long time ago, when someone submitted a "cleanup: patch for the mach= zwd > >> watchdog driver, I approved it but added this comment. > >> > >> > If anyone is still using the HW supported by this driver, it would > >> > be a prime target for conversion to use the watchdog subsystem. > >> > This would reduce code size and improve driver stability. > >> > _That_ would be useful. > >> > >> > The only reason for replacing 0 with NULL is to make a static chec= ker > >> > happy. This kind of change adds zero value to the code. Instead, i= t > >> > takes time from those who have to review the patches and apply the= m. > >> > >> > If we ignore such patches, we'll get them again and again, taking > >> > away even more time. If we don't ignore them, we encourage submitt= ers > >> > and get even more useless patches. If we try to discourage them, w= e > >> > risk being accused of being unfriendly. This is a perfect lose-los= e > >> > situation for maintainers. > > > > Agreed. I keep getting one to fix "of of" in a comment. The fix is > > always to drop an "of", but that's actually wrong because it's > > supposed to be "OF". I keep pointing this out and *never* get the > > right fix. I don't fix it myself because at this point, I find > > continuing to get "fixes" entertaining. > > > >> I do wonder if enabling BUILD_TEST on such drivers is any better. > > > > I think that and trivial fixes on a specific driver are completely > > different. If you want to test build one driver, that's not too hard. > > Find its kconfig value, turn it on and build the right arch. For tree > > wide stuff, it's a real pain to ensure you built everything. For > > example, the only way to build many Cavium Octeon drivers is with the > > Octeon defconfig which is just one of dozens configs for MIPS (which > > is still a bigger mess than arm32 ever was). > > > > Sure, but I still argue that this isn't worth it for drivers like this on= e. > Are you going to submit a fix ? Because otherwise I'll submit a patch > to drop COMPILE_TEST from MACHZ_WDT. I honestly don't know what the fix is. There's a compiler flag to allow 0 address, but that seems like a big hammer. From what I read on the fix for gcc-12, we shouldn't be getting this, but I haven't confirmed. I was hoping for comment from Geert as the issue doesn't appear to be the driver, but the arch code. Furthermore, I just built the same HEAD and config as reported and don't see this error. I'm using kernel.org nolibc gcc 13.2.0 which should be the same version. Rob