Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp5287153rwb; Wed, 9 Aug 2023 01:25:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFPf0RR3CkKiPoys+EyRApencMdSwtypHrpv5LS7xd2YCVGT4LEX6vUJg57G9IWw2fWqMS5 X-Received: by 2002:a05:6a20:1445:b0:12b:2170:7b13 with SMTP id a5-20020a056a20144500b0012b21707b13mr1929984pzi.16.1691569546657; Wed, 09 Aug 2023 01:25:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691569546; cv=none; d=google.com; s=arc-20160816; b=vfOmrNKquM1acL+SFbWTO7x1vx9CNSCw6wlDTZwoXVDs1JPIepmwXKZrjicveXWnvn LQIekqO/MLWpApy9A6vCytwRm7rERJbvjPPQuIGJesPZ0sHxuiHQxAzY224TBadh5ho1 3ol7y6ZSv3a3klqJWNXVIGzjkytNhofob1Z0Xl5WemzV6GtQJBHSlBb8/P4qtb2GfRi9 K4HK1gO8o9MDNaK++b0Rn54Wd/Tl6TizhySk6c9q0FZUl5DYP4K87IKyiurQqSRmsm5i 6HSV/gMjtqykwd0LqKhAe6b+w6nE+pnjmBaLem0s2KLB41HpydvWabnJkJDVCQsRDSiv hPOw== 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; bh=KkRlYK6yg0/Jnn28EAzOvjUBjN9ZW6OwnP/4DACqDkU=; fh=O63IryxzGsBPvfSEuBQrY4gQO4Dt5kdLA7nkl36gPo8=; b=jEskt9pgZ8kHK5UZwqm4n/obGz1KFbrrqFlv83Cs1Tvx9AnK3EFaz7pYb4P5RAgVF6 cGS76ERb3jtwJZIT2DPK746fZCdsB4B8Xeh1FYb1+ibgLo6Snt2ZIOBQHSNFPxg2RkYy 21hLVSfeFrh4TeuoTQoTBDgt8XNYuSQvK0+qJcD2IUbgDCVoKRxCWIdSS5S1IKfByef6 FskKktvQ4cOVnJupjDt3fxd5yP9MCKdiQDvYk4gFaQIJ9TReCcUL7ToyHOg2gQTOOugg aWHXw67PANsLxbFbU3MsBRCIjIVSBzjP8LP+RXN0asQ9th37hPDUahVZEOeONHDqbjbY WNeQ== 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 i2-20020a170902c94200b001b8c47563e7si1686372pla.28.2023.08.09.01.25.34; Wed, 09 Aug 2023 01:25:46 -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 S230503AbjHIHxk (ORCPT + 99 others); Wed, 9 Aug 2023 03:53:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229588AbjHIHxj (ORCPT ); Wed, 9 Aug 2023 03:53:39 -0400 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EE161736; Wed, 9 Aug 2023 00:53:38 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4RLMkQ4Q7Nz4f3q3W; Wed, 9 Aug 2023 15:53:34 +0800 (CST) Received: from vm-fedora-38.huawei.com (unknown [10.67.174.164]) by APP4 (Coremail) with SMTP id gCh0CgAX9Kb2RdNkvuInAQ--.27870S2; Wed, 09 Aug 2023 15:53:33 +0800 (CST) From: "GONG, Ruiqi" To: Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , Roopa Prabhu , Nikolay Aleksandrov , Kees Cook , "Gustavo A . R . Silva" Cc: netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, Wang Weiyang , Xiu Jianfeng , gongruiqi1@huawei.com Subject: [PATCH] netfilter: ebtables: replace zero-length array members Date: Wed, 9 Aug 2023 15:51:36 +0800 Message-ID: <20230809075136.1323302-1-gongruiqi@huaweicloud.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgAX9Kb2RdNkvuInAQ--.27870S2 X-Coremail-Antispam: 1UD129KBjvJXoW7trWxAw4DCF47uF1fZryfCrg_yoW5Jry5pF yjka4qyrWUtay2grW7tay7ZF4avws8Gr17JrWxG34FyF90yay7WrWxKry5KFyqvrZ5uanx ArWftry0gFZ7taUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkIb4IE77IF4wAFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4 vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7Cj xVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x 0267AKxVW0oVCq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG 6I80ewAv7VC0I7IYx2IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFV Cjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JM4IIrI8v6xkF7I0E8cxan2IY04v7MxAIw28I cxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2 IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI 42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42 IY6xAIw20EY4v20xvaj40_Wr1j6rW3Jr1lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2 z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7IUbPEf5UUUUU== X-CM-SenderInfo: pjrqw2pxltxq5kxd4v5lfo033gof0z/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE 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 From: "GONG, Ruiqi" As suggested by Kees[1], replace the old-style 0-element array members of multiple structs in ebtables.h with modern C99 flexible array. [1]: https://lore.kernel.org/all/5E8E0F9C-EE3F-4B0D-B827-DC47397E2A4A@kernel.org/ Link: https://github.com/KSPP/linux/issues/21 Signed-off-by: GONG, Ruiqi --- include/uapi/linux/netfilter_bridge/ebtables.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/uapi/linux/netfilter_bridge/ebtables.h b/include/uapi/linux/netfilter_bridge/ebtables.h index b0caad82b693..673b00df162c 100644 --- a/include/uapi/linux/netfilter_bridge/ebtables.h +++ b/include/uapi/linux/netfilter_bridge/ebtables.h @@ -87,7 +87,7 @@ struct ebt_entries { /* nr. of entries */ unsigned int nentries; /* entry list */ - char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); + char data[] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); }; /* used for the bitmask of struct ebt_entry */ @@ -129,7 +129,7 @@ struct ebt_entry_match { } u; /* size of data */ unsigned int match_size; - unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); + unsigned char data[] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); }; struct ebt_entry_watcher { @@ -142,7 +142,7 @@ struct ebt_entry_watcher { } u; /* size of data */ unsigned int watcher_size; - unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); + unsigned char data[] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); }; struct ebt_entry_target { @@ -155,7 +155,7 @@ struct ebt_entry_target { } u; /* size of data */ unsigned int target_size; - unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); + unsigned char data[] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); }; #define EBT_STANDARD_TARGET "standard" @@ -190,7 +190,7 @@ struct ebt_entry { /* sizeof ebt_entry + matches + watchers + target */ unsigned int next_offset; ); - unsigned char elems[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); + unsigned char elems[] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); }; static __inline__ struct ebt_entry_target * -- 2.41.0