From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 697D1C61DB3 for ; Thu, 12 Jan 2023 22:49:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239903AbjALWtw (ORCPT ); Thu, 12 Jan 2023 17:49:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240317AbjALWtp (ORCPT ); Thu, 12 Jan 2023 17:49:45 -0500 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54FF25EC24 for ; Thu, 12 Jan 2023 14:49:36 -0800 (PST) Received: by mail-pf1-x430.google.com with SMTP id a30so14893033pfr.6 for ; Thu, 12 Jan 2023 14:49:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=SWHx2ArszmWOMvOmL9HMTqeLRyXml8x4aecIK4J1xfM=; b=T2d6xQChtkuCRaI870QbrNhFwwVCxfB/ltmBQERjU/+oJfBXhY/cz1RHeYyjIdraiI 0RZZ1XMlhfo7B3NY4rKRaaxKLRWCZVgiVPgtgr17CgwOgHSIpYEu4zv+lpmlbvU88r6e jK9fILTLJRz6ovtajskEvsL9o5FUM/PTks/iA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=SWHx2ArszmWOMvOmL9HMTqeLRyXml8x4aecIK4J1xfM=; b=vAe7txE9Zy8zSEJhIhW5R144AErjpTC/JQljOyFIvhhM02zzEgtMzWX9JZyOa8nCsH oRChsvinuoHZsrepyEgq+SaH8HuLi7YVviyZIByTBZG1mQ1uZDZG45zdirIFgARgUdc2 vZrMUpB/DacHqA5yY58UCbwce+ZhKjzioqtRYna9hQFIS8htJDhByhoktXW8frppUhkT cMiiIQKsRiuPi7hQzwbG61hYAt6rpdCCGbkXHQ4m8b+r/QZRwXH/S2l2n55XOusiHY10 jIO2udJm3eyF0iwYyLLmaVQTF9jeukQirr0QLS8i3fEQ/6aDASp6p5LfZcRnDBeETbpI vsMA== X-Gm-Message-State: AFqh2kruvN6G+qf7/gH2JIFpbfVabQtWvf7dYke3Tbl+PwF+r6GC2eWh RsO7sC0xBJBwKv8eIlWACMssBw== X-Google-Smtp-Source: AMrXdXtrkkqEGE9cFZZR5OGma23Ht+dZor8UGc1LpcFDNVZF1aHL808lC/1ioJhhRsAmf4y/+tUmZw== X-Received: by 2002:aa7:99c4:0:b0:589:69ec:c6bc with SMTP id v4-20020aa799c4000000b0058969ecc6bcmr8245382pfi.21.1673563775884; Thu, 12 Jan 2023 14:49:35 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id x14-20020aa79a4e000000b005811c421e6csm12220412pfj.162.2023.01.12.14.49.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 14:49:35 -0800 (PST) Date: Thu, 12 Jan 2023 14:49:34 -0800 From: Kees Cook To: "Gustavo A. R. Silva" Cc: Ben Skeggs , Karol Herbst , Lyude Paul , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH][next] drm/nouveau/nvkm: Replace zero-length array with flexible-array member Message-ID: <202301121449.EE489AA@keescook> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-hardening@vger.kernel.org On Mon, Jan 09, 2023 at 07:39:30PM -0600, Gustavo A. R. Silva wrote: > Zero-length arrays are deprecated[1] and we are moving towards > adopting C99 flexible-array members instead. So, replace zero-length > array declaration in struct nvfw_hs_load_header_v2 with flex-array > member. > > 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: Kees Cook -- Kees Cook From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7BD0AC54EBE for ; Thu, 12 Jan 2023 22:49:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8475F10E958; Thu, 12 Jan 2023 22:49:40 +0000 (UTC) Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3C39110E952 for ; Thu, 12 Jan 2023 22:49:36 +0000 (UTC) Received: by mail-pf1-x430.google.com with SMTP id 200so8729992pfx.7 for ; Thu, 12 Jan 2023 14:49:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=SWHx2ArszmWOMvOmL9HMTqeLRyXml8x4aecIK4J1xfM=; b=T2d6xQChtkuCRaI870QbrNhFwwVCxfB/ltmBQERjU/+oJfBXhY/cz1RHeYyjIdraiI 0RZZ1XMlhfo7B3NY4rKRaaxKLRWCZVgiVPgtgr17CgwOgHSIpYEu4zv+lpmlbvU88r6e jK9fILTLJRz6ovtajskEvsL9o5FUM/PTks/iA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=SWHx2ArszmWOMvOmL9HMTqeLRyXml8x4aecIK4J1xfM=; b=EnJAE2j3XHmYB8doBDJghDKd7Mg1WUdTq6eqmQw9RlSZUHcRFnP2TXySsoraXVxtQW 17g6WeaURr0xBxat6JSid4TBax2dLHn0YofBm75EuvhY+Vapa8UuszI1EVnFNAxW6X28 wLv9ki05SOPkzoPHZqBzVKQvWbapWtW1fdDA3ndsxqMlam46RGPJ1E5EdLXXUabTGLiV AMYp5Nav06WF4d/Kblmvxrn1kdVj0jQ/QoAgcM1QbVx/kFNDGtXHXxiNQneBJbMeEDdO t/xyuRd/IaKfeWkPMja+u+8k75K6pbZFrT0idcoIb2P4Y9Vq/a9tWREVW7Y+5kM6hkPh YZdw== X-Gm-Message-State: AFqh2krRUma/8KssKHyDFc6ojo+xwd8x/9X3n3e19qe1PwX1o0SKnPR1 OmGupxM+WSqdjPlKfqYVhsF+RQ== X-Google-Smtp-Source: AMrXdXtrkkqEGE9cFZZR5OGma23Ht+dZor8UGc1LpcFDNVZF1aHL808lC/1ioJhhRsAmf4y/+tUmZw== X-Received: by 2002:aa7:99c4:0:b0:589:69ec:c6bc with SMTP id v4-20020aa799c4000000b0058969ecc6bcmr8245382pfi.21.1673563775884; Thu, 12 Jan 2023 14:49:35 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id x14-20020aa79a4e000000b005811c421e6csm12220412pfj.162.2023.01.12.14.49.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 14:49:35 -0800 (PST) Date: Thu, 12 Jan 2023 14:49:34 -0800 From: Kees Cook To: "Gustavo A. R. Silva" Message-ID: <202301121449.EE489AA@keescook> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Nouveau] [PATCH][next] drm/nouveau/nvkm: Replace zero-length array with flexible-array member X-BeenThere: nouveau@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Nouveau development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Ben Skeggs , Daniel Vetter , linux-hardening@vger.kernel.org Errors-To: nouveau-bounces@lists.freedesktop.org Sender: "Nouveau" On Mon, Jan 09, 2023 at 07:39:30PM -0600, Gustavo A. R. Silva wrote: > Zero-length arrays are deprecated[1] and we are moving towards > adopting C99 flexible-array members instead. So, replace zero-length > array declaration in struct nvfw_hs_load_header_v2 with flex-array > member. > > 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: Kees Cook -- Kees Cook From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5A4F5C54EBE for ; Thu, 12 Jan 2023 22:49:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1794210E955; Thu, 12 Jan 2023 22:49:39 +0000 (UTC) Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3F72510E953 for ; Thu, 12 Jan 2023 22:49:36 +0000 (UTC) Received: by mail-pg1-x532.google.com with SMTP id s67so13802289pgs.3 for ; Thu, 12 Jan 2023 14:49:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=SWHx2ArszmWOMvOmL9HMTqeLRyXml8x4aecIK4J1xfM=; b=T2d6xQChtkuCRaI870QbrNhFwwVCxfB/ltmBQERjU/+oJfBXhY/cz1RHeYyjIdraiI 0RZZ1XMlhfo7B3NY4rKRaaxKLRWCZVgiVPgtgr17CgwOgHSIpYEu4zv+lpmlbvU88r6e jK9fILTLJRz6ovtajskEvsL9o5FUM/PTks/iA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=SWHx2ArszmWOMvOmL9HMTqeLRyXml8x4aecIK4J1xfM=; b=tpBsWhLvSb1hXS9ZlZHaVxJPpH2smZkju7HJ20eXHV0IIyRGRkRfOvbKP9sH9nYY4w NJRZyBZKojzAbHOXTF08ntQ2op33ANFxgYoqCuX1hWr3eUe5c7gsoQo7r0TuQUVZOsB5 Y1JTjJaTcxzdD2J70rmnEy9ot2LXRWft54dnLk0VQxRTovaQ7QN74Pzn0Ys+HEJU36kk S01g7aWKd52S/9eDL0YD14js69/2jKfnOWZsJzOMXT2nDXAr6Ve8wLSWsqhajT6fUos3 y3wX+uXMphZNIqyj89o5oNoEJtrlZBZKxqpesL0LThYdYHmajwjoWiV6WVEO6xw6Xr/Q h3kg== X-Gm-Message-State: AFqh2kqgaYm/PUitMQGq1kCjQMrHSAQ6hV8u+/nSYPLh5rHWzrYdhxpL oFALD8D/kap8htmIUF4Fm97/Bw== X-Google-Smtp-Source: AMrXdXtrkkqEGE9cFZZR5OGma23Ht+dZor8UGc1LpcFDNVZF1aHL808lC/1ioJhhRsAmf4y/+tUmZw== X-Received: by 2002:aa7:99c4:0:b0:589:69ec:c6bc with SMTP id v4-20020aa799c4000000b0058969ecc6bcmr8245382pfi.21.1673563775884; Thu, 12 Jan 2023 14:49:35 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id x14-20020aa79a4e000000b005811c421e6csm12220412pfj.162.2023.01.12.14.49.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 14:49:35 -0800 (PST) Date: Thu, 12 Jan 2023 14:49:34 -0800 From: Kees Cook To: "Gustavo A. R. Silva" Subject: Re: [PATCH][next] drm/nouveau/nvkm: Replace zero-length array with flexible-array member Message-ID: <202301121449.EE489AA@keescook> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Karol Herbst , nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Ben Skeggs , linux-hardening@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Mon, Jan 09, 2023 at 07:39:30PM -0600, Gustavo A. R. Silva wrote: > Zero-length arrays are deprecated[1] and we are moving towards > adopting C99 flexible-array members instead. So, replace zero-length > array declaration in struct nvfw_hs_load_header_v2 with flex-array > member. > > 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: Kees Cook -- Kees Cook