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 3BE6B463B96 for ; 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=BV0SQvmILGMbn3Z8C6BkH2EYPnh3usXy5sax6DlOhsilAY9KVuyworoa/1lp7mH+lKXLqgUtdY3cA02DYM5aKcx7wB9BDdyNIYjmalxuR1s0JwTp949wuSrMgBbDtT9kRpCVelEUQSekWRjqyp99kRek2NxtbOu0Jia8BZfbpKg= 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=Flu2cb+O; 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="Flu2cb+O" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B5751F00899; 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=1790342480; bh=nnp5HOIGcAOyxCzrPOE4p3KTTNVywfZTwHRYxevT9oE=; h=Date:From:To:Cc:In-Reply-To:References:Subject; b=Flu2cb+OOJe+RDoDJQrGbsJowghhwvyWhFhhD3p3l3wq5Ex0Md5wbVj6yOVdLfePX 1PGAeXz8uVyGdSQPziBdQDdIG/Gv294GJ9E45iYKLyWLbAUhp+O1izLTfBPHmQD7jT 0ZIHSdNdBQbSIWWnhF8WjbV5pQ27qnGamiD8S+MlInOhCEbzE59jyBMwDdYGmlNSSq 9S1B2/pYQLP8qFxP3jp7ubgIoiaraIDw34SVn3a5YnwrMjQRF029coGeQOtPdsd3Op ADTNtyMd6oZgQGjPJB80tbJYLLfxDnxiu9PECke7gTWj8SRlaxPmobooblVNJkfg+v I+933a/dY+Geg== 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-arch@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?