Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp3006559rwi; Tue, 1 Nov 2022 14:43:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM67PKGGogQdqJiyS75kt6GqewljjDI3LzCSGoVNQNf0MmwflB/1NduQb1c6PbFCfcKU6YNs X-Received: by 2002:a17:906:8473:b0:77b:efa8:50e4 with SMTP id hx19-20020a170906847300b0077befa850e4mr20168378ejc.250.1667339033910; Tue, 01 Nov 2022 14:43:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667339033; cv=none; d=google.com; s=arc-20160816; b=bRQUa0a/ollgk/xjNIlWq7rZmMU/jqNKU/18j7feZ/prTSEX+2QTxgKsGFL0PTWhTQ DnUdrJg1OHS1/L4XUKi/UnyZ8MBzTTkMWx6N37iNn+sKyS5gFpdySlJspYBpULcwAaNT Ql7MSMHxUuDEvau/bpz0JR7MnZFHLYq5BBF/dqtqiE/Tr7dIbQspl3Xs4mj2eW35cLdx l0Nh709tMX0HxT7XlgdhBKhr1KYJd+HuI5ixaGLCuNU2/CX+TP9Vwv7DWGkutHPHw+yK LgNT/+GQs0VCKUO9jWNN+8+bYRL4BsNNmwEQrhGfVPHvT+j/qhHUBD0M2TaljD02GQOT /dhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=6indUiCprMB0zjMLWvS6nYLrTKO3j8yjpLRzZacHoFM=; b=a5OYnFd4C00T6BjiAiLgSgwuZJiShUd5LdS0hvmPqIQP4CWoxWQ2XYZJtyt9llDEyg FW/+B+gY5mc/+PenPlVQoyjd2RdXjGYInD7paKYT/Cjd/G2Gi+jgcyYsEobjNvQpTCQA k7z39VT5z2fkj1p2cWHtp3kPrOdL+vEOuX4i7fsm0rHwWBQUr5HXAhUxSk/Jw4oYtUQ+ EG0qZq95R0pZrPADzPLwezRcrF2G0DnwSfJ5vaqAEfXyCRZIfdSF0GVVYqYBAS5UXW7u 4LycX+HFmAGDNXlwgP4i4bsdTO/ZAQ18T90IP+8Z4qV6ln8nFFGvUqjEK9Dum+rJ2dLw n4MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RvakqeHb; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds14-20020a170907724e00b00770d9e664f8si15221055ejc.152.2022.11.01.14.43.30; Tue, 01 Nov 2022 14:43:53 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RvakqeHb; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229988AbiKAVOG (ORCPT + 96 others); Tue, 1 Nov 2022 17:14:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229517AbiKAVOE (ORCPT ); Tue, 1 Nov 2022 17:14:04 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9378D1C42C; Tue, 1 Nov 2022 14:14:03 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id 20so14520878pgc.5; Tue, 01 Nov 2022 14:14:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=6indUiCprMB0zjMLWvS6nYLrTKO3j8yjpLRzZacHoFM=; b=RvakqeHbzhIjgHA0SHrXXMScjhxIrsj98u/WPUsnoZgBbiMepcA6jWfxYuNLJ7YZKl 7hQeN3cKsZHdgVa+by5PM9qwRAXlERGLBHtTYOATeumHcVBVJh12ijdH6hESg72b+wzw r27PIVAfsU6wsVC8jduamUDUDRQGWhqhfjL5fViN9pYW8AANiVCifGt4VRus4t71d8K3 bh7W73of1dfjJMq65cWyAGs/0pzBnk7/j5SrDExP3MtP88tq0+DVqzpssHJq3RUnbrxN ZOeHFX75u3sTcdI+a70BLWQq/HCHg3+AiUVcjCfn2nTWdfUYiuiN2UIjcWOAoiGnLtrt Ah6w== 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=6indUiCprMB0zjMLWvS6nYLrTKO3j8yjpLRzZacHoFM=; b=wtDLwGDX8GJdCIu9/lu6GJZIlpu4fyPWU8XyEiYreGwiEzNxUVocWMBB4OPeIobRaO aP1DEIdFqlx3ndZkSQ9h6jNo+RO2CbqDtG4gT7sHCEpzCHCeeH4ZaAM+q7DJtBop2CGB zPcp9wg2f3j2N+jp3UT8KXvHuwSZNzN+oGYdWnMzdYnVdAFsdziB0Yx/0vlYnEM3jR0C ufRt4JgoRR0V4MDaqII4nBm/HAj0FkRnLsOZyl/tgEhEMMEVt0bOcveNynOFOlP6fwx6 H3yBR3JtZ8jPmiVNnVxPs3ClzVF/p4WH3fV/o+soWKPmOnS5lewwEYssmwQ6WSZ14GX5 yjUw== X-Gm-Message-State: ACrzQf3uYJK+3ynSaqrapBct0axZ42I0rtnSrVNhazQnel8y9LchaCOp CpYrGqmII2mCCFCFNHMJ3a0= X-Received: by 2002:a05:6a00:234d:b0:561:ec04:e77e with SMTP id j13-20020a056a00234d00b00561ec04e77emr22151908pfj.14.1667337242960; Tue, 01 Nov 2022 14:14:02 -0700 (PDT) Received: from mail.google.com ([103.229.249.253]) by smtp.gmail.com with ESMTPSA id o20-20020a170903009400b0018685aaf41dsm6804056pld.18.2022.11.01.14.13.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Nov 2022 14:14:02 -0700 (PDT) Date: Wed, 2 Nov 2022 10:13:54 +1300 From: Paulo Miguel Almeida To: Alex Deucher Cc: Alex Deucher , Christian =?utf-8?B?S8O2bmln?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH v2] [next] drm/radeon: Replace one-element array with flexible-array member Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, 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 On Tue, Nov 01, 2022 at 10:42:14AM -0400, Alex Deucher wrote: > On Fri, Oct 28, 2022 at 11:32 PM Paulo Miguel Almeida > wrote: > > > > One-element arrays are deprecated, and we are replacing them with > > flexible array members instead. So, replace one-element array with > > flexible-array member in struct _ATOM_FAKE_EDID_PATCH_RECORD and > > refactor the rest of the code accordingly. > > > > It's worth mentioning that doing a build before/after this patch results > > in no binary output differences. > > > > 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 [1]. > > This seems like a worthy goal, and I'm not opposed to the patch per > se, but it seems a bit at odds with what this header represents. > atombios.h represents the memory layout of the data stored in the ROM > on the GPU. This changes the memory layout of that ROM. We can work > around that in the driver code, but if someone were to take this > header to try and write some standalone tool or use it for something > else in the kernel, it would not reflect reality. > > Alex > Hi Alex, thanks for taking the time to review this patch. I see where you are coming from and why you may be apprehensive with the approach. From my humble point of view, I think that the artificial line that separates "what we can change at will" and "what we should be extra careful not to break/confuse others" is whether the header file is part of the UAPI. Given that atombios.h isn't publicly accessible, I tend to gravitate towards the first one. > > + /* empty fake edid record must be 3 bytes long */ > + sizeof(ATOM_FAKE_EDID_PATCH_RECORD) + 1; I am assuming that this is the part of the patch that makes you feel concerned about how devs will get it (should they copy this header), is that right? If so, would a comment on the ATOM_FAKE_EDID_PATCH_RECORD struct specifying the size of the struct when empty do the trick? - Paulo A.