Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp12476392rwd; Fri, 23 Jun 2023 06:43:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5T1+5SO9P4Gtmbe1eEuqvn1Obynhd3VxpEfKY69JUM1NnoTC+wrenUiLVVCfzuhRKNVYZX X-Received: by 2002:a05:6a00:2482:b0:66a:6339:e909 with SMTP id c2-20020a056a00248200b0066a6339e909mr3725712pfv.11.1687527798490; Fri, 23 Jun 2023 06:43:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687527798; cv=none; d=google.com; s=arc-20160816; b=ZOvN4U3cuzPV8ysg1WAY+PWdW+okHPHy0zpTu9viz8k8MJyFrRHP52BaFCg3eecUbp khJvCY+RjXH8Z7n//xfuaxVeVs6lcrmVBbefuSRJoXGdvc5h7MxsM3aAmToEEN86W2Xc jiGL1X4nk4Z/8Riq58wzuEG16PlNvbvXXP2rfOatfzInJ51ZSAejI0F7FDPWkajD+WAn ON4Uhv814xqKzfE/dioBCXX6Ztta1iVNbM1M8pyRW+eqK9ULUP4WHU8w+QPWmDGpKLMk qPEYIhBE/ZOtvRAYthb6rJq+WySH2S75UpnFqqoKuOVJYUeKyeSUs7x9Z6HvbdJh4W8O LBug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=Y8A8k0tA/cqs45FkTgNAREZQ4nboAd/PXjLVK7lZpGk=; b=reGASl5etj/Q9xZxmnt4jHcOEwwxOtcSewZPhn9A2Etl6+wF4PTuwte87FqVSSN7M3 YJs85LFrg+2KjyH6OYXiSxzANZZwx1vNQOQZa5lH0KTNMpoJv1WO0hu7vS1i0wwXNPIR ky+o1c7Q7Lu1Rq7lmQNsLfSD9A1KgGbEe53tsNgKOt293b+qhk0ZZ9CmagC8MXInrzuI wa3pR+zmf4otxSppNZodaz316PtnW6xdD6BbkPoD92YF3F6aVOPuuNTZUtNepQCVIvNX 3+jXLcHEusdrKWJ7FivIaSG4qE+bGCf/7MHLyfxIiXqB2/4RUxCMmlosDNItpJ00lcZ/ UnJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w12-20020a637b0c000000b0054fdf311fadsi9033816pgc.30.2023.06.23.06.43.03; Fri, 23 Jun 2023 06:43:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231316AbjFWNQr (ORCPT + 99 others); Fri, 23 Jun 2023 09:16:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231271AbjFWNQm (ORCPT ); Fri, 23 Jun 2023 09:16:42 -0400 Received: from elvis.franken.de (elvis.franken.de [193.175.24.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 42AC5BA; Fri, 23 Jun 2023 06:16:40 -0700 (PDT) Received: from uucp by elvis.franken.de with local-rmail (Exim 3.36 #1) id 1qCgeU-0002sn-00; Fri, 23 Jun 2023 15:16:38 +0200 Received: by alpha.franken.de (Postfix, from userid 1000) id 72D90C0375; Fri, 23 Jun 2023 15:10:19 +0200 (CEST) Date: Fri, 23 Jun 2023 15:10:19 +0200 From: Thomas Bogendoerfer To: "Gustavo A. R. Silva" Cc: "Maciej W. Rozycki" , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH][next] MIPS: dec: prom: Address -Warray-bounds warning Message-ID: <20230623131019.GD11636@alpha.franken.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 22, 2023 at 05:43:57PM -0600, Gustavo A. R. Silva wrote: > Zero-length arrays are deprecated, and we are replacing them with flexible > array members instead. So, replace zero-length array with flexible-array > member in struct memmap. > > Address the following warning found after building (with GCC-13) mips64 > with decstation_64_defconfig: > In function 'rex_setup_memory_region', > inlined from 'prom_meminit' at arch/mips/dec/prom/memory.c:91:3: > arch/mips/dec/prom/memory.c:72:31: error: array subscript i is outside array bounds of 'unsigned char[0]' [-Werror=array-bounds=] > 72 | if (bm->bitmap[i] == 0xff) > | ~~~~~~~~~~^~~ > In file included from arch/mips/dec/prom/memory.c:16: > ./arch/mips/include/asm/dec/prom.h: In function 'prom_meminit': > ./arch/mips/include/asm/dec/prom.h:73:23: note: while referencing 'bitmap' > 73 | unsigned char bitmap[0]; > > This helps with the ongoing efforts to globally enable -Warray-bounds. > > This results in no differences in binary output. > > Link: https://github.com/KSPP/linux/issues/79 > Link: https://github.com/KSPP/linux/issues/323 > Signed-off-by: Gustavo A. R. Silva > --- > arch/mips/include/asm/dec/prom.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/mips/include/asm/dec/prom.h b/arch/mips/include/asm/dec/prom.h > index 1e1247add1cf..908e96e3a311 100644 > --- a/arch/mips/include/asm/dec/prom.h > +++ b/arch/mips/include/asm/dec/prom.h > @@ -70,7 +70,7 @@ static inline bool prom_is_rex(u32 magic) > */ > typedef struct { > int pagesize; > - unsigned char bitmap[0]; > + unsigned char bitmap[]; > } memmap; > > > -- > 2.34.1 applied to mips-next. Thomas. -- Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]