From patchwork Tue Jan 10 01:39:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 41248 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2487819wrt; Mon, 9 Jan 2023 17:41:02 -0800 (PST) X-Google-Smtp-Source: AMrXdXsyHegkWEGsirpIB4ve/FxiH8JD47qi6hXPQ4Kf3BleByy1Omp130QB38CCP/8GpeyaFwfv X-Received: by 2002:a17:90b:19c8:b0:227:6e2:8037 with SMTP id nm8-20020a17090b19c800b0022706e28037mr7389835pjb.32.1673314862376; Mon, 09 Jan 2023 17:41:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673314862; cv=none; d=google.com; s=arc-20160816; b=Y7mQQKyDjUnMO+EUlg5p5bkEp7b7fEuBhjhK9/6asrU3wIqRMBupyuRs7LKSqj2V+R /AKCJjlyZTdsBo62OyGcYSIIDMho9ij33FQN96apVphcgwSGc2ZPjSVFmXj92HwRRucK 3cD6TVzCc6Gt2doEXxSo1+kn3nzpTcSfGf5A6jhMg5exRah/SzDiZYRC+ql0x4lxF6E9 E7mgDybMEUhmng0Ca5BsHZTuSJOSWbLnMy6CZ1zXg5Xx2N2zTJkuPxAd2IF+Kw7Co2es p8GeHm7ZcqiTdF760zysUC8s5RcGzxsQqZJuQSWqAA//uvzEwzfZRZAXKfXXPYmmoMYG 2ljg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=oOxfFN+ep24neAz/zRS8svpN1o0ovgrfMnz2SF5mLo8=; b=O/ClkAEF0w4kNNiSoLTsJVZAuPTKVcKIvgAharjLH3/T3jbK11vgucUbJyIgFFefYs n4Dg3khMj56n75XmFQHSwx/gxuQ1GqleSCcf04EowHSB6ai8XrsLRVW5XFeZinqvAViP kqSjWskKv9sTYAh0IaPzYvWUNsxe1BCUFxiLWGV2Wl5knvVLLdrtcW0sUrwBQoaaaBY1 IwK/obOjvFN0yuXdoTYJ8I1KbPOIdQgdy7RxlqCpQtWIT4qaJkJLX8Lv1ZM1x65Aq9lo 6sl4Je7JBmA7lCT61wgaHbOLH5wlBgGHnK96OHyjddQQuJMbyIZlW0qps4W2BPn1QX0v pXfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=stbxdH54; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w16-20020a17090a8a1000b00220ac450834si14151833pjn.12.2023.01.09.17.40.49; Mon, 09 Jan 2023 17:41:02 -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=stbxdH54; 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 S229984AbjAJBjp (ORCPT + 99 others); Mon, 9 Jan 2023 20:39:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229940AbjAJBjn (ORCPT ); Mon, 9 Jan 2023 20:39:43 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 779AAA1B3; Mon, 9 Jan 2023 17:39:42 -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 31E45B80F4B; Tue, 10 Jan 2023 01:39:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 154A1C433D2; Tue, 10 Jan 2023 01:39:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673314779; bh=vrLfad/dEaF4ahcbuNSigjh7IBnihHnE+uf7TW186+Y=; h=Date:From:To:Cc:Subject:From; b=stbxdH54iAbI7V6ELAgCiLxBF7prOUSb0gNS9VBXx72Bh+BH0p2ddWfgCS0ibUQpN kZH0y2ZrtoQaPDDTc0pvnvYmfTXzBQISAg3mOG+Q3L12HRD0/qAnkeJ2g6SKKzyERl MQ8i1kqjyHjezyhf3L7hPLfD3Wl8CHkLicKLOA6N03goN9oPzLcfUUu+sRsBbjWMVW yHslk5gzxvtPpyi22fOiTQR4EBf9kpsMOwEUL9iFYwkbvs5bwr9jJ6rRXJs7YKO+Br 4kHoP2n/akDIUnQIE3AkNobhE9TPnuJpEiSufhu4ZaAi+ajLyVhKyvwZmH3vfkJMTR YZy61XPD13GBw== Date: Mon, 9 Jan 2023 19:39:47 -0600 From: "Gustavo A. R. Silva" To: Oded Gabbay Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] habanalabs: Replace zero-length arrays with flexible-array members Message-ID: MIME-Version: 1.0 Content-Disposition: inline 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754597804932439753?= X-GMAIL-MSGID: =?utf-8?q?1754597804932439753?= Zero-length arrays are deprecated[1] and we are moving towards adopting C99 flexible-array members instead. So, replace zero-length arrays in a couple of structures with flex-array members. This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines on memcpy() and help us make progress towards globally enabling -fstrict-flex-arrays=3 [2]. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays [1] Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [2] Link: https://github.com/KSPP/linux/issues/78 Signed-off-by: Gustavo A. R. Silva Reviewed-by: Stanislaw Gruszka --- drivers/accel/habanalabs/include/gaudi2/gaudi2_packets.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/accel/habanalabs/include/gaudi2/gaudi2_packets.h b/drivers/accel/habanalabs/include/gaudi2/gaudi2_packets.h index 8bf90fc18bf5..a812f8503f90 100644 --- a/drivers/accel/habanalabs/include/gaudi2/gaudi2_packets.h +++ b/drivers/accel/habanalabs/include/gaudi2/gaudi2_packets.h @@ -59,7 +59,7 @@ struct gaudi2_packet { /* The rest of the packet data follows. Use the corresponding * packet_XXX struct to deference the data, based on packet type */ - u8 contents[0]; + u8 contents[]; }; struct packet_nop { @@ -80,7 +80,7 @@ struct packet_wreg32 { struct packet_wreg_bulk { __le32 size64; __le32 ctl; - __le64 values[0]; /* data starts here */ + __le64 values[]; /* data starts here */ }; struct packet_msg_long {