From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BCFC41442F; Fri, 25 Sep 2026 13:21:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790342482; cv=none; b=C3X5re5Xs6lzgHskmiXz6xVeFWmh/laK+tPuxwoXZhLPzWgkFPcT4vD2gInTYeKDbkjIz/s/1RPXLLE6HzekAXwsckjJ+TzSs39Bi9Zm38xenhw+C6/cS10RphCqtNi0Dz/zAbaaQbhjS/Vds+5A8vSuppqnxbdd/H8NbI8G59k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790342482; c=relaxed/simple; bh=BDnnA+wMmkd0GK+KM4NviCTA3nc+bJ+Nj2nL92tXupw=; h=MIME-Version:Date:From:To:Cc:Message-Id:In-Reply-To:References: Subject:Content-Type; b=jg3BzKrbDR0ssVDGkpi+7AaXWTagkiYv7DWs8WseUhfN+DLIDMGMCQkwlDLylpM1Nob61OVPWTekT7+8o61+PoMP/F/t3LIsFl7CsIEiCKH9cyoF3lSn+d40zGZBG4NjAPWYUhtEEETfElV6/6HfkysaYz7z3BnHtY+nz6/6s0o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dCEHQwIH; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dCEHQwIH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C9D81F0089B; Fri, 25 Sep 2026 13:21:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1790342481; bh=nnp5HOIGcAOyxCzrPOE4p3KTTNVywfZTwHRYxevT9oE=; h=Date:From:To:Cc:In-Reply-To:References:Subject; b=dCEHQwIHAhEiqlOSbrZQu1HXQa1FLHFwqHzuiaWNdDfpkRC64TjVFIdlfmQ/cC1Xe 5/x7z6b78oA85nUYJkhhVWS8m7YVDRuF8VMGX+8rwe32893U/G2wwb4Y0raywMihfY FTeKUBoSvQwQwCb+PMrEZFm//AxI2wvrke2D1l3xxKdY5LrTNr2Suhx+Xqj+OTVLjH ycPe7hVFy37MVF57XMF8NkRxN/ghC464JDgmpjISx3NNYF/evQVOporj48duNi9wkl 9mfXhpdqEscNELl29xOugeHUUc3HBRLwK3gf2yuMp5dJ4raF5w/jWI5qKVikGOYQJj dbAzFpt36ROMA== Received: from ams-compute-02.internal (ams-compute-02.internal [10.64.2.62]) by mailfauth.ams.internal (Postfix) with ESMTP id A368B198005A; Fri, 25 Sep 2026 09:21:17 -0400 (EDT) Received: from ams-imap-11 ([10.64.2.31]) by ams-compute-02.internal (MEProxy); Fri, 25 Sep 2026 09:21:17 -0400 X-ME-Sender: X-ME-Proxy-Cause: dmFkZTGm//tvmOX7B1Z6aN22M5G/NImGiJI5CG+zWqb2Cz5VW2X9+opF+vwz1PFhssRYty oD8XLhwfOFQeDBAu0BJPFbOMXjR8yUQo3h6q/OacKqpkU0GkT9Plok53rbQqbjW3fcguac PFdoO4I+6Si4H1xddpnS0WdVtz3WxK8NoXh8W2ru9lYH925szGXJjXx3Y+vB4izliBqDc+ J1ni3rDNHLoAHy+nSwmI7gwEkj85FUw4B/aFanwVvYpsZBAaCygwrpKO9P9m45bmAZJLrD IJDwKb6eb1YdHlf6/5vjdaV2WvJTzeZLEugQPszF1ilewRcazFfoDb+r1OV6+YI9SmRMJg punkHkfINQz5IsX9htKb+bV85phrVMj3lY2al1xwQs997rDo15yxZfcBBoQwE5h/etuk0Q nqMv8To7cMP5rPdvrcccT5GG+1mY0sC5o8vka5eieW4pZ6HyCnqc3r/mX/WGMGmAWlu7TY FCTQnFBks8dPu0cUVM3LZv3/ULJLlsa0QPLsBPxssiLh4T+spgXVbzKrpqM5xPZoKD2AWW 53sHXPvAERtyW/YFkqdqVkA20ADoFtRf6jfgl+6TgGI6dwIiT0zxjXHEHDKbBEBkL9MLdx GjfkR3sbyYPnN7CeuGYvFBSUCxcnTRuwR9qzQWhUUUMfK0KXvALVLTj9CJOw X-ME-Proxy: Feedback-ID: ice86485a:Fastmail Received: by mailuser.ams.internal (Postfix, from userid 501) id 622AEF80086; Fri, 25 Sep 2026 09:21:12 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Fri, 25 Sep 2026 15:20:51 +0200 From: "Ard Biesheuvel" To: "Jason Gunthorpe" , "Jonathan Cameron" Cc: "Alexandre Ghiti" , "Albert Ou" , "Arnd Bergmann" , "Catalin Marinas" , "Jonathan Corbet" , "David Sterba" , "Ilias Apalodimas" , linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-efi@vger.kernel.org, linux-riscv@lists.infradead.org, "Mark Rutland" , "Palmer Dabbelt" , "Paul Walmsley" , "Randy Dunlap" , "Simon Glass" , "Shuah Khan" , "Nick Terrell" , "Will Deacon" , "Alexandre Ghiti" , "Conor Dooley" , linux-integrity@vger.kernel.org, "Palmer Dabbelt" , patches@lists.linux.dev, "Ross Philipson" , "Sami Tolvanen" , "Song Shuai" Message-Id: In-Reply-To: <20260925125945.GN9354@nvidia.com> References: <0-v1-27d06b313981+8b-arm64_drtm_jgg@nvidia.com> <3-v1-27d06b313981+8b-arm64_drtm_jgg@nvidia.com> <20260924154902.0000528b@oss.qualcomm.com> <20260925125945.GN9354@nvidia.com> Subject: Re: [PATCH 03/16] efi/libstub: Free cmdline_ptr in efi_pe_entry Content-Type: text/plain Content-Transfer-Encoding: 7bit On Fri, 25 Sep 2026, at 14:59, Jason Gunthorpe wrote: > On Thu, Sep 24, 2026 at 03:49:02PM -0700, Jonathan Cameron wrote: >> On Thu, 24 Sep 2026 10:53:06 -0300 >> Jason Gunthorpe wrote: >> >> > Sashiko points out that efi_handle_cmdline() allocates this memory and >> > hands it over to the caller. If efi_pe_entry() ever returns it should be >> > freed. Add a __free annotation. >> > >> > Fixes: 42c8ea3dca09 ("efi: libstub: Factor out EFI stub entrypoint into separate file") >> > Signed-off-by: Jason Gunthorpe >> > --- >> > drivers/firmware/efi/libstub/efi-stub-entry.c | 2 +- >> > 1 file changed, 1 insertion(+), 1 deletion(-) >> > >> > diff --git a/drivers/firmware/efi/libstub/efi-stub-entry.c b/drivers/firmware/efi/libstub/efi-stub-entry.c >> > index aa85e910fe595e..83fade2b0d3b84 100644 >> > --- a/drivers/firmware/efi/libstub/efi-stub-entry.c >> > +++ b/drivers/firmware/efi/libstub/efi-stub-entry.c >> > @@ -40,7 +40,7 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle, >> > unsigned long image_addr; >> > unsigned long image_size = 0; >> > /* addr/point and size pairs for memory management*/ >> > - char *cmdline_ptr = NULL; >> > + char *cmdline_ptr __free(efi_pool) = NULL; >> >> Can we move this down to just above the call to efi_handle_cmdline that >> does the constructor side of this? >> >> I see none of the efi stuff follow those guidance note that went in >> cleanup.h. > My bad. Patches welcome. > Yeah, I stuck with what was there.. It looks kind of weird that way: > > char *cmdline_ptr __free(efi_pool) = NULL; > status = efi_handle_cmdline(image, &cmdline_ptr); > if (status != EFI_SUCCESS) > return status; > That looks fine, no?