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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0D378C4321E for ; Wed, 30 Nov 2022 08:45:08 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D724D8525C; Wed, 30 Nov 2022 09:45:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="h0muUPV1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9176385261; Wed, 30 Nov 2022 09:45:05 +0100 (CET) Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2480685254 for ; Wed, 30 Nov 2022 09:45:02 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-ej1-x62c.google.com with SMTP id gu23so21391638ejb.10 for ; Wed, 30 Nov 2022 00:45:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=EJsPVkWgilkWJ4qIj74qWtEsWOE9lgdudcBgo//63yg=; b=h0muUPV1ov1KVNgz5Lt4TMzSiqfRYykcSjA9qo4GwWnklEffIzkeu6p8w8hcTrRLMM 8eO/E0n0xU6ns0UuR2l2wH5eMO/K/bcUgaG3PLh3uPtKlB5+mYX2zjfJVRnps7ThGf3b q3qQoUzVyewEKcNt9rKcFWgxS+O0eio5SpB1HRBPb2+S9CgSZIoUtlVorWXHe9RpPp3Y 4kjWGEV4LJU6hD1p3iQ746p5bn6gyFEyVxPEDY/D5gBmKLc3Qy5GkLi5QTwH2TNt7bAx jsBxBtfITdq+EpaaLXVcCtkMfMdsmJVZc52TICSu9cA9kRVFBKZsBzpEyQU2hzwM9E9Z 0ALg== 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=EJsPVkWgilkWJ4qIj74qWtEsWOE9lgdudcBgo//63yg=; b=qvoT0WcyL3IWVHm4t7NKy6tqtibtVfN8dGzNQFbQklCI2T0UXgrttMFzUuaiOZuD5C 37+haXovGSBUH3a+ZHiNUpz8b2eRR2FZRxBdMD1Weq+CuTtyM44NdFwfaJDLvp4SqB0Y 67eZJsPk0cskdQv0p+TESMeBhC/TI1C7A1aOoIJNigo0hgGkriYqb5dTukqtQ1IRFS1u LsFM1pIkoE48+/aVDwsl964I7K1bqYxUhvRy1UkbFnWUDiv3PVih1xbC7yqn6pTZwMKf 8EKXvwyHsgt6RWQuUjaRPDfxGfjMqBy/CxWX3HwLXvOyRLvN3Rk7GdCvGKkj5CUTWyqe B73A== X-Gm-Message-State: ANoB5pmPd7GbNkuRqQ73D4+sN4kdeDMG7j2KH7uLuLIFXwLC/JTqYkDF HHTH+/3naaVX61o/wToDWdZQfw== X-Google-Smtp-Source: AA0mqf79X42ER3pYOgFBeVNIEr13vY1POqztO92TQaa5gumJrorInvZZt39H9JzcAjdNCcWEoWF6fQ== X-Received: by 2002:a17:906:65c4:b0:7ad:d250:b907 with SMTP id z4-20020a17090665c400b007add250b907mr50619293ejn.737.1669797901457; Wed, 30 Nov 2022 00:45:01 -0800 (PST) Received: from hera (ppp078087234022.access.hol.gr. [78.87.234.22]) by smtp.gmail.com with ESMTPSA id e15-20020a170906c00f00b0078c213ad441sm390260ejz.101.2022.11.30.00.45.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 00:45:00 -0800 (PST) Date: Wed, 30 Nov 2022 10:44:58 +0200 From: Ilias Apalodimas To: Heinrich Schuchardt Cc: u-boot@lists.denx.de Subject: Re: [PATCH 1/1] efi_loader: fix handling of DHCP acknowledge Message-ID: References: <20221126161056.127376-1-heinrich.schuchardt@canonical.com> <00ab8f6a-9222-e14d-d567-ce24ebb2ce69@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <00ab8f6a-9222-e14d-d567-ce24ebb2ce69@canonical.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean On Wed, Nov 30, 2022 at 08:50:07AM +0100, Heinrich Schuchardt wrote: > > > On 11/30/22 08:37, Ilias Apalodimas wrote: > > Hi Heinrich, > > > > On Sat, Nov 26, 2022 at 05:10:56PM +0100, Heinrich Schuchardt wrote: > > > The dhcp command may be executed after the first UEFI command. > > > We should still update the EFI_PXE_BASE_CODE_PROTOCOL. > > > > > > Don't leak content of prior acknowledge packages. > > > > > > Handle out of memory. > > > > > > > The patch looks correct, but the description is a bit confusing. Apart > > from what you mention this patch also fixes > > > - An unchecked allocation > > I can add this. > > > - shadowing of the global netobj > > netobj was a local variable before this patch. > Ah missed that Thanks! /Ilias > Thanks for reviewing. > > Best regards > > Heinrich > > > Can we please update the commit message to something that mentions all of > > these? > > > > Thanks > > /Ilias > > > > > Signed-off-by: Heinrich Schuchardt > > > --- > > > lib/efi_loader/efi_net.c | 13 ++++++++++--- > > > 1 file changed, 10 insertions(+), 3 deletions(-) > > > > > > diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c > > > index 69276b275d..96a5bcca27 100644 > > > --- a/lib/efi_loader/efi_net.c > > > +++ b/lib/efi_loader/efi_net.c > > > @@ -30,6 +30,7 @@ static uchar **receive_buffer; > > > static size_t *receive_lengths; > > > static int rx_packet_idx; > > > static int rx_packet_num; > > > +static struct efi_net_obj *netobj; > > > /* > > > * The notification function of this event is called in every timer cycle > > > @@ -660,10 +661,16 @@ void efi_net_set_dhcp_ack(void *pkt, int len) > > > { > > > int maxsize = sizeof(*dhcp_ack); > > > - if (!dhcp_ack) > > > + if (!dhcp_ack) { > > > dhcp_ack = malloc(maxsize); > > > - > > > + if (!dhcp_ack) > > > + return; > > > + } > > > + memset(dhcp_ack, 0, maxsize); > > > memcpy(dhcp_ack, pkt, min(len, maxsize)); > > > + > > > + if (netobj) > > > + netobj->pxe_mode.dhcp_ack = *dhcp_ack; > > > } > > > /** > > > @@ -853,7 +860,6 @@ static efi_status_t EFIAPI efi_pxe_base_code_set_packets( > > > */ > > > efi_status_t efi_net_register(void) > > > { > > > - struct efi_net_obj *netobj = NULL; > > > efi_status_t r; > > > int i; > > > @@ -982,6 +988,7 @@ failure_to_add_protocol: > > > return r; > > > out_of_resources: > > > free(netobj); > > > + netobj = NULL; > > > free(transmit_buffer); > > > if (receive_buffer) > > > for (i = 0; i < ETH_PACKETS_BATCH_RECV; i++) > > > -- > > > 2.37.2 > > >