Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7087272rwl; Mon, 9 Jan 2023 17:53:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXtN/q9NUpvHveqjgzfLQcQMIYxFUYU2+uFFzW1H9ySjKHYTTY2/KLyxplCf2cNOPAFmxIYX X-Received: by 2002:a17:906:9f1a:b0:84d:2025:8501 with SMTP id fy26-20020a1709069f1a00b0084d20258501mr11707098ejc.22.1673315589619; Mon, 09 Jan 2023 17:53:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673315589; cv=none; d=google.com; s=arc-20160816; b=vcmVKGS2O02QjuQiIaADR4UmCkSqDwMd+ceJqgyU5GG88HJuGIFBb7PhQ9D1lc3fMc eGypT898rO8FotJUE17kNk1x9zOo8wfzsTmBpP+v/m0aSQ24TLJqRB8miaIDkkrhPSqg wBmFURcu9VT44H2klrLne+52QQiaco2mj+GtTdP6F591F2bjS3zSLgOiiyViI4qLkISt eXI1JqQzOpLFnMox0BZQKm+NXa4HfOp9N5lPy+X8zkW6I+ox4u0w6SkMdA050jwYr5tO iyJaDOfAVzznnTrYAW80wL6pRHA9Jw64MKd/wW/xNSj2PJR0QH9fXSi+olPxDg0E+JDd 21Bw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wt9-20020a170906ee8900b0084cc41e20e2si11108250ejb.624.2023.01.09.17.52.57; Mon, 09 Jan 2023 17:53:09 -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 + 53 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-Type: text/plain; charset=us-ascii 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 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 --- 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 { -- 2.34.1