Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp2589399rwl; Fri, 6 Jan 2023 08:22:51 -0800 (PST) X-Google-Smtp-Source: AMrXdXstXWrCA2dYvsT29u49+bTPm594Ey9aBet8xmYkrXh5lJFb/2n3WJlcR9u3JPBjQwEoGg4O X-Received: by 2002:a17:90b:1982:b0:225:dd16:ac4c with SMTP id mv2-20020a17090b198200b00225dd16ac4cmr44877550pjb.16.1673022170938; Fri, 06 Jan 2023 08:22:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673022170; cv=none; d=google.com; s=arc-20160816; b=sQ6JDoPgKfkkS11gMUgY+XCkf3YryHRCmvFXWHhTvWbvvH7/N8WQjGUsDCAgLkoUWW cQ6roQATqioSe17+ZlukkeMBznU54vQMKXQ1uDh+VfeqftWf40WZcosh3xyAZ+G22JLf 1Ew5W0RsrX9jVwM/GjhxGc4HkqP9he+JXagyO4sqRtvUbRsOxkq1vA6NQlVspAFrXG4Q Bx1vhIYGkD7hSSnzKJFl2svLfsqu7yIijNZ4zWPWzgV4jyVw/T67TqQqEg8JSzOZGklE pHf2SiSaFvME7f72Konpf7Z7nkzOrO1WBiW4PC6LcEwOAN0tzSzdNeCMF+IiLwgfzFlr zhfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jK8P+ORiduqLxMJTMytEz5IsNo+7ABA1+XV0amAKF0E=; b=e1Eko0rBZpVohR4cXtCCtY1mmuBIs+lEbopnVNt3TAnmDzbLvyBfIpsTOHGcLyiWv4 8PDdbzYvY0G1XYZKom0MtTQJro+UFiwOQBg5a6hfO8MWSjYZQ6xLptZyGTqZQcijI8Wn 2vOmWXpRbHaxp7M6egq4NCVtZIDzn51wVXSyXQZrFwia6wR+W7K8WsIfDk077xYdsecM WSAOIXqKw0+Bdc4WklyUc7UzGEixh6DJUfHbU3Y2IQbl3NAgaunrwDDeuoagcHuTp/Vs +/+FdFB8IPMlZgw9j5TvqwFJ4IltDBDqEUe0Oj85XB7S3nRGwNqvDOtO7y2i26YrAvJu gI9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qzWxQcfJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 3-20020a17090a004300b00223f3998ce8si1613590pjb.43.2023.01.06.08.22.44; Fri, 06 Jan 2023 08:22:50 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qzWxQcfJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234282AbjAFQDj (ORCPT + 54 others); Fri, 6 Jan 2023 11:03:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231237AbjAFQD0 (ORCPT ); Fri, 6 Jan 2023 11:03:26 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C663687A9; Fri, 6 Jan 2023 08:03:25 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4930DB81CDC; Fri, 6 Jan 2023 16:03:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5E2CC433D2; Fri, 6 Jan 2023 16:03:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673021002; bh=4SszgloLESJ9Z/oK4FE1YKuoW/GK96FBWkUuAnmvgLQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qzWxQcfJNUp5m9I7Ji/7kTT8W6fKWhXGKUoxWK2wy7GU1g7bi/gFJJMviU/QzPDTx FHzRvCmfh/QDbeWwGE497oDvmMs7WR47xTiCmWF7w5Z6LnMrkqASEusXKG2/JThbng y9uU3c6NtrBBRoZ3zwkS5bOqGGhyx+F27pdgIgoemW9s14k4b5ryw48DOW067uvnbZ oYkNDV9E5X2qq/Uv/Ozgsl6SW8vwNN8/hfyQBHiMb1TRXGsj9wt8r9sKUSWlLhRQI0 Uy78KccldBm4xAjotlaJmicEVJWu9kh2tFlUYYeJcac3ErnoPoIX4pVuk9p+A5nHdA 2EGzqKnchCxTA== Date: Fri, 6 Jan 2023 10:03:27 -0600 From: "Gustavo A. R. Silva" To: Kees Cook Cc: "David S. Miller" , Jakub Kicinski , Justin Iurman , Eric Dumazet , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] ipv6: ioam: Replace 0-length array with flexible array Message-ID: References: <20230105222115.never.661-kees@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230105222115.never.661-kees@kernel.org> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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, Jan 05, 2023 at 02:21:16PM -0800, Kees Cook wrote: > Zero-length arrays are deprecated[1]. Replace struct ioam6_trace_hdr's > "data" 0-length array with a flexible array. Detected with GCC 13, > using -fstrict-flex-arrays=3: > > net/ipv6/ioam6_iptunnel.c: In function 'ioam6_build_state': > net/ipv6/ioam6_iptunnel.c:194:37: warning: array subscript is outside array bounds of '__u8[0]' {aka 'unsigned char[]'} [-Warray-bounds=] > 194 | tuninfo->traceh.data[trace->remlen * 4] = IPV6_TLV_PADN; > | ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ > In file included from include/linux/ioam6.h:11, > from net/ipv6/ioam6_iptunnel.c:13: > include/uapi/linux/ioam6.h:130:17: note: while referencing 'data' > 130 | __u8 data[0]; > | ^~~~ > > [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays > > Cc: "David S. Miller" > Cc: Jakub Kicinski > Cc: Justin Iurman > Cc: Eric Dumazet > Cc: Paolo Abeni > Cc: "Gustavo A. R. Silva" > Cc: netdev@vger.kernel.org > Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Thanks! -- Gustavo > --- > include/uapi/linux/ioam6.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/uapi/linux/ioam6.h b/include/uapi/linux/ioam6.h > index ac4de376f0ce..8f72b24fefb3 100644 > --- a/include/uapi/linux/ioam6.h > +++ b/include/uapi/linux/ioam6.h > @@ -127,7 +127,7 @@ struct ioam6_trace_hdr { > #endif > > #define IOAM6_TRACE_DATA_SIZE_MAX 244 > - __u8 data[0]; > + __u8 data[]; > } __attribute__((packed)); > > #endif /* _UAPI_LINUX_IOAM6_H */ > -- > 2.34.1 >