Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp1508315rwl; Thu, 5 Jan 2023 14:52:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXuhmCsbZ4UkxShvrjgS+TGFtP0j6IzzvSP5iLj0jGgHA7pPpxtRezymQTGVhnegNSGDoJeB X-Received: by 2002:a17:907:d68e:b0:798:d745:f87 with SMTP id wf14-20020a170907d68e00b00798d7450f87mr45194039ejc.73.1672959135969; Thu, 05 Jan 2023 14:52:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672959135; cv=none; d=google.com; s=arc-20160816; b=C8NLKcpFFes+sWc4edgyswzpU8MgqlImXXrUUb8X5zVrjBMLcZ3Gycx44pK17S2+e+ SAuty4+/OnpegYOwuidbBX+wsl7XYt1FqbBA5XCITbfIZZxO2T9nfFRGWpX3lKUV0ThN IMjZhaPv0SVg56085eBr5qV9OcJcOrp4DJPBIngNZATroutFpn/QrVB/7yQ2wUSvsCpt 7zxhRagZkpjzj9qNXB4pAWwAi3VgFb5AkhMZNOgXq4z5F2YuIbTt6FhFBomhBKWJiq5y 3W9YW72yWFWceOrD+EndpZ78Ro6OXI6WcFpSy1C0Ec+UjOJwcBpbHnNd+KyhtduR1Hkj Hu4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=+/rwlFIn0hzbcNETA4wyU6wemvJ1Z4GiTdDdXZcLwaY=; b=Lb/EzOZ6FkDw9WtfTjp/HVKtO9kSp9M8hNokCuRGdzgL89neocNGwJOHb1TZcjgtPY PtAIFtbWwrg0hC5FfC9cPnXZ1VGSQLh04GGKSW+DaWBFqpG5s7LhOXexYfFCcR13tzps A14c48KXCoQAB/+gbywTba5ianMUBNCWJ62CHA72OtI6eme8Sj7yNnMoF3HUTPB6OKig rw2l1J59u4twSVSLNIOJE3nRassHDol8+7/vUWG7lqCVsz2JNkk85JkgG5slDy6F7m4f XMAKytPRSTLUyri4KtmKciG0PMByOaf10q7oCTkWYLc/7gJ+tkz/nUmUtsjILKlF7GAr eVvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dkTzAk+1; 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=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di19-20020a170906731300b007c10a0c31a3si34475823ejc.425.2023.01.05.14.52.01; Thu, 05 Jan 2023 14:52:15 -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=@chromium.org header.s=google header.b=dkTzAk+1; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235815AbjAEWVX (ORCPT + 55 others); Thu, 5 Jan 2023 17:21:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229694AbjAEWVU (ORCPT ); Thu, 5 Jan 2023 17:21:20 -0500 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C0B469528 for ; Thu, 5 Jan 2023 14:21:20 -0800 (PST) Received: by mail-pf1-x429.google.com with SMTP id 124so26420797pfy.0 for ; Thu, 05 Jan 2023 14:21:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+/rwlFIn0hzbcNETA4wyU6wemvJ1Z4GiTdDdXZcLwaY=; b=dkTzAk+1ntj0auXOIzhxwO3g6qxTLW5rcQufexl+8slQLretMtDK9f5HKR4Aliyo39 TBXDLPSZZ+cPoJEh5357XW2coZYeq+1e9MNXq7GSKaeRBrIVMhLdSL2gmSWInW2aRur7 qX5tn4dbTdyy53FZ/I69t664nI2sKKOffks2Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+/rwlFIn0hzbcNETA4wyU6wemvJ1Z4GiTdDdXZcLwaY=; b=hJT/WBghWGdy5XdGnp0fEEXiU+PVXnnCM0zc0bXxoM+8g8Qf+6we0KLckxmkXNhwAN K4V99F2sVX7Yy0mZu/cqKUA6eZ8GdbXQsD/y6B2EsEZxDRrLgqTlLgBD1WDGiOnODAiM 7P/5SZJ0aiSiaoHlKMhbcFhse1bXdi0c04V8OOadzerW4+oMq16YLA/ZHi8IcbCLy7y8 vxBuuqIEMhRkOZD79DujWGJR4MTSBqjcY7YJgYJjZKTMHpZ6uUTDhwDpgLw8gi3OKdjd R/QUGS06zkiiQ0T6jl6TEnVgni/ugKl0Wfl3E2EFU6JV0DKgg10Ga/BVaIxYJOdhm5W9 e9YA== X-Gm-Message-State: AFqh2kqfVeMYSjUfh5Rg3ZgzM5GKjnSjQuSuDTltV4NcxKkt+zoNsVW1 II/M5Sn/dy9Qc/wa4lvjavNH5w== X-Received: by 2002:a62:6d82:0:b0:580:da4d:d42a with SMTP id i124-20020a626d82000000b00580da4dd42amr41325570pfc.14.1672957279547; Thu, 05 Jan 2023 14:21:19 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 68-20020a621947000000b00580e679dcf2sm21861943pfz.157.2023.01.05.14.21.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 14:21:19 -0800 (PST) From: Kees Cook To: "David S. Miller" Cc: Kees Cook , Jakub Kicinski , Justin Iurman , Eric Dumazet , Paolo Abeni , "Gustavo A. R. Silva" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH] ipv6: ioam: Replace 0-length array with flexible array Date: Thu, 5 Jan 2023 14:21:16 -0800 Message-Id: <20230105222115.never.661-kees@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1685; h=from:subject:message-id; bh=8PkLlA/lLOXSW+eJB32T+aG9Kn60zUa4hKXC+rzMGLs=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBjt01cz7/LecK3nXxfm63JdHDplN1K4Q+y5tGGGSPM pUHKzwGJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCY7dNXAAKCRCJcvTf3G3AJvCJD/ 9dtKcuau0YnqLh8x7WrForeOZfMnYtRszMXUYKVft4FOrOsQ1BAzfridH4lEFedSI0AKz34hSCQxNI 9pU9cHvUjhC/gCo/ssOAQl9wJJ4HZhUqFWjzKpAHuaHE3e1VRoOJYt6L/RoF0EjE0XlVCLMZ9x1Vqs r+Le39VVbucfueuZyrYi9EzDHAw3zF46MNjMcq+m/FWvq4/n+g79tmQRJqEmUeLr2eHVdXqu+AI39R /t6xkHYShlreOKfsg4+qeySTppv/Go0fNAkVuU6ExrA/f6uWBZUQxb8NhSgRcR7U9RF1O3YydmqOFN cqzv7/8m6aUw9mxIojwCPpM+cn1jvTR13BLgwVYe5m+RW4LxUceL04xi/L1YZEhALEWzDXj+gWxotQ GVhwpNAPpztHLjX8fY0Jdzu3Pk8iAPFfqQkl1YNz89kk2bPNyuCDKjBPyGHzeK4x6GNgbKkQZ68Ilm TroxxrefIN30wEIhaLki1WABr+rZs0neuiRFkMMtfZAkA9PbdO1iIb260Ei+FbNutOcTYx1AZR6v7b Mcm1Dx0wF27u+OS0E6bME4TPp/JN3R6YpcsFNUa37xsXm/z7wfsjF10gPcUaMWTHbKaGIXG4X4Z+dc nPIUp2LUnE7439+DrZRdr9Nc/UhV8/G+2Hu+dkW97XuczBseF8nZVsKhlUvQ== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 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 --- 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