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 AEE94D46C01 for ; Thu, 29 Jan 2026 00:20:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0C5EE10E2F0; Thu, 29 Jan 2026 00:20:28 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="bJVinoa0"; dkim-atps=neutral Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 69CF010E2F0; Thu, 29 Jan 2026 00:20:26 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 71F7A6001A; Thu, 29 Jan 2026 00:20:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5174C4CEF1; Thu, 29 Jan 2026 00:20:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1769646025; bh=Lpd9kC+1aougw4btdvzon7ENBBCLCGY+Jd5QG33v4yw=; h=Date:Cc:To:From:Subject:References:In-Reply-To:From; b=bJVinoa06mK4xDCvuVXnFC/HzeXb5E5HreC05Ge7Gbap+2Ww2i1UazpaSSuCwpbxX prY4MV0AbboQIm7vAP+TP3ycwQ0JJMqBwzQqF/3LWLYE25Cvi/QLp3qZjaHPMubdAl RHrTVZI5hWzMVTNqcYq4RSuckDQCz9eYgIceqaB9e5CsCzioNaOl2vsIjQb2x936Q5 yvt6K+CGz0VTgy45y+Wm1TbAEerZjmxQkMUQsCoI3qii5c+y9JlOI9R9aGW84ddTNl 6xA7u54/EFrClsJyDkB8/vijBmalgJ3b/wVJcQL1pQwZoK+tLWgF21G12W1J8RxAi3 fR/ne5i7l1Zsw== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 29 Jan 2026 01:20:18 +0100 Message-Id: Cc: , "Paul Walmsley" , "Palmer Dabbelt" , "Albert Ou" , "Alexandre Ghiti" , "Miguel Ojeda" , "Boqun Feng" , "Gary Guo" , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , "Benno Lossin" , "Andreas Hindborg" , "Alice Ryhl" , "Trevor Gross" , "Alexandre Courbot" , "John Hubbard" , "Alistair Popple" , "Timur Tabi" , "Edwin Peer" , "Zhi Wang" , "David Airlie" , "Simona Vetter" , "Bjorn Helgaas" , "Alex Gaynor" , "Dirk Behme" , , , , To: "Joel Fernandes" From: "Danilo Krummrich" Subject: Re: [PATCH v2 1/5] gpu: nova-core: use checked arithmetic in FWSEC firmware parsing References: <20260126202305.2526618-1-joelagnelf@nvidia.com> <20260126202305.2526618-2-joelagnelf@nvidia.com> <259bdacf-d16e-4fff-9f6b-f860feb40aa8@nvidia.com> In-Reply-To: <259bdacf-d16e-4fff-9f6b-f860feb40aa8@nvidia.com> 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Wed Jan 28, 2026 at 4:14 PM CET, Joel Fernandes wrote: > On 1/28/2026 5:53 AM, Danilo Krummrich wrote: >> On Mon Jan 26, 2026 at 9:23 PM CET, Joel Fernandes wrote: >>> @@ -267,7 +264,12 @@ fn new_fwsec(dev: &Device, bios: &V= bios, cmd: FwsecCommand) -> Re >>> let ucode =3D bios.fwsec_image().ucode(&desc)?; >>> let mut dma_object =3D DmaObject::from_data(dev, ucode)?; >>> =20 >>> - let hdr_offset =3D usize::from_safe_cast(desc.imem_load_size()= + desc.interface_offset()); >>> + // Compute hdr_offset =3D imem_load_size + interface_offset. >>=20 >> I do get the idea behind those comments, but are we sure that's really a= good >> idea? How do we ensure to keep them up to date in case we have to change= the >> code? >>=20 >> If we really want this, I'd at least chose a common syntax, e.g. >>=20 >> // CALC: `imem_load_size + interface_offset` >>=20 >> without the variable name the resulting value is assigned to. >>=20 >> But I'd rather prefer to just drop those comments. > The idea of adding these comments was to improve readability. However, I= =20 > can drop them in the v3, that's fine with me. Yeah, that's why I wrote "I get the idea". :) But as I write above, I'm concerned about the comments getting outdated or inconsistent over time. Besides that, it more seems like something your favorite editor should help= with instead. > Do you want me to wait for additional comments on this series, or should= =20 > I make the update and repost it? Thanks, As mentioned, I tend to think we should just drop them, but I'm happy to he= ar some more opinions on this if any.