Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp3017010rwi; Tue, 1 Nov 2022 14:54:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6dlhG5BXzR1Bfthvd93JLJ/5Z6ZRlvsa+QOyoTGXtSR5Gd7DRiXgRax/dfbwLTjLQQeTyb X-Received: by 2002:a17:906:14d2:b0:7ad:be76:956f with SMTP id y18-20020a17090614d200b007adbe76956fmr16429764ejc.197.1667339649537; Tue, 01 Nov 2022 14:54:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667339649; cv=none; d=google.com; s=arc-20160816; b=EHMdL4m7x2BlW5EUgUCL7+Lri3/OnZZ3/fk4LL9ziIh5VConRh2kXY2kFXwkGzdr8Q /3MXDffvpCUVOxQIZkE4ZSRwgiL/kA5a4MivE+aUHKw/ubJXhj0z+gTuai4bTaX+Hg4o VBrG2208B5bWEl9gbCwohJkkZ9ANA2ORVxw9Tz8k623pWno7+zBy8SMiwwAEqgyff6tf h8su5qus3SPJ+rt5ySsIvt6qHwWkAMzXnChFRPybYUpvkOgX+qn48/pIGMF64azOnZD3 AuFVENTgtlBor7q7e2zS/ZIQe0XZy+ibUePxxndyc6LNKSFHRIznVOhryGBP4OJc8Zq5 R0Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=7floQmYMzLgaddTMF2cgROiayJCZkDQQYG5jcMnB2Mg=; b=nq56Zx/0s1QE8rSSv4IQprzlAWASeq8x+oy4livxhfK4RtNR8Wqo7UJtYdTOfL/Ju/ sibKG32pvAE1u6jaiP3qPP7sb4ZgTtog5Dx5sbXg8mL9TkefLqstLLftOOaM1G6w0KH0 MvHrABsWWx1ZMEQLXrXfcqcAG3JoGgFNNZHOa5tGzxn8XEUfhDjT2y0jJX7nG49ARvvi eep4pqAmdPVpJ3BDXK4q3NmtVxc8cmMcAW+pa7I39rchkl2HVcwwakPZxspM4s8YQ8/D /5b/vu8GXypfgFgiCTHihc5zKxFxAb1UYs6Jcf5/2Ke4rpvFdBGurJcsH4BVMoozQ9WG 67Mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CUfRAOLG; 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 r12-20020a1709062ccc00b007ad9f03aa6fsi10613653ejr.283.2022.11.01.14.53.45; Tue, 01 Nov 2022 14:54:09 -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=CUfRAOLG; 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 S230330AbiKAV2O (ORCPT + 96 others); Tue, 1 Nov 2022 17:28:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230056AbiKAV2F (ORCPT ); Tue, 1 Nov 2022 17:28:05 -0400 Received: from mail-oo1-xc2b.google.com (mail-oo1-xc2b.google.com [IPv6:2607:f8b0:4864:20::c2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A16411DF15; Tue, 1 Nov 2022 14:28:03 -0700 (PDT) Received: by mail-oo1-xc2b.google.com with SMTP id x6-20020a4ac586000000b0047f8cc6dbe4so2236366oop.3; Tue, 01 Nov 2022 14:28:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=7floQmYMzLgaddTMF2cgROiayJCZkDQQYG5jcMnB2Mg=; b=CUfRAOLG/90T2J7O+9cTJGRFsZDOddWLZ7QygnM1H/0Jbr/5N8WQkUrvg0y0475BqV OLHYPd+AvEyH95tkvnbCRYACyKOOuNcI0NhLCqN75HTpOJf0jGNkq21AxYSjahqZ2V9X QDIuL9afXBV/pMjDnnax+Va9kqJtBB0qHFwswOtHzcEEKk21lYxKqwl/J/OYhyX+4XdU 6A91pNXCQmqcNEPHtw6o7o0XtZP9tSZqYwDLczOkMLxjw5oobQ6u0kJ47dchzuOEFOyQ UWEYvZ9OOM8x+FGIT/Zr19nCZ8ABgot0Ye01RImeViDtjA/t5gvRbpcpobmQlRaKJ7gM sFQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=7floQmYMzLgaddTMF2cgROiayJCZkDQQYG5jcMnB2Mg=; b=G1le+xWNEVNvjrN9uAwzz+qQSCXghtobno0PSlSyBsDHGK4VrnsuNoKXbiJz+jmJLu s78XF+bvpM7jhYGsWh+wPU/bzc3S8lMblVxnyAbV2owsR+ZhV4dBPRauiRdPsfA/ZqYl jr/turzcIwIrQlwvoYgStx8oRFq9eDwHP/0zB46k0hR/cL3SxeiLkRnUqN8m60KlBRb2 88ylJOPc7VSKue4Sw3ooEbLLIrVmYB/YbMlO3qM1gWd8KG+nBX3GJRy2pMocTrcPELTs cPypDv9FaATTQoXb23tAJ+yBqFml3AQP8/llsoIKNAECEAfU7ILG+UBZXIPTNpKdPOAQ jeqA== X-Gm-Message-State: ACrzQf3e88wDVeDPYDHR0l9o0Y8q2qeB/XWgU3qujWbwSVq2YiaLL2+a leruIdadpHWiCIPyx6hUQZir8ggmeg12DIoZYL20aTRK X-Received: by 2002:a4a:b913:0:b0:480:b3bf:7812 with SMTP id x19-20020a4ab913000000b00480b3bf7812mr9031444ooo.97.1667338082817; Tue, 01 Nov 2022 14:28:02 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Alex Deucher Date: Tue, 1 Nov 2022 17:27:51 -0400 Message-ID: Subject: Re: [PATCH v2] [next] drm/radeon: Replace one-element array with flexible-array member To: Paulo Miguel Almeida Cc: Alex Deucher , =?UTF-8?Q?Christian_K=C3=B6nig?= , "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 Content-Type: text/plain; charset="UTF-8" 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 1, 2022 at 5:14 PM Paulo Miguel Almeida wrote: > > 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. It may not be publicly accessible, but it describes a physical thing that is burned into millions of GPU boards out in the wild. There are tons of open source tools out there that take these headers from the kernel to be able to parse the date in the ROM on the GPU. If those applications sync up with the latest version of the header from the kernel, it will break their tools. The next time someone from AMD syncs up the header with the version maintained by the vbios team, the change could accidently sneak back in and break the code. It seems to me in this particular case that the header should reflect the physical layout of the ROM since that is what it describes. Alex > > > > + /* 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. >