{"id":817985,"url":"http://patchwork.ozlabs.org/api/patches/817985/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20170924195716.3433-15-xypron.glpk@gmx.de/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170924195716.3433-15-xypron.glpk@gmx.de>","list_archive_url":null,"date":"2017-09-24T19:57:13","name":"[U-Boot,14/17] efi_loader: fill return values in SimpleNetworkProtocol","commit_ref":null,"pull_url":null,"state":"superseded","archived":true,"hash":"87a78349344029febf5de9d1f2e4c6a859b0acd7","submitter":{"id":61270,"url":"http://patchwork.ozlabs.org/api/people/61270/?format=json","name":"Heinrich Schuchardt","email":"xypron.glpk@gmx.de"},"delegate":{"id":3400,"url":"http://patchwork.ozlabs.org/api/users/3400/?format=json","username":"agraf","first_name":"Alexander","last_name":"Graf","email":"agraf@suse.de"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20170924195716.3433-15-xypron.glpk@gmx.de/mbox/","series":[{"id":4841,"url":"http://patchwork.ozlabs.org/api/series/4841/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=4841","date":"2017-09-24T19:57:03","name":"efi_loader: Simple Network Protocol","version":1,"mbox":"http://patchwork.ozlabs.org/series/4841/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/817985/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/817985/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3y0dbM72x0z9t30\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 25 Sep 2017 06:09:19 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid B3443C22153; Sun, 24 Sep 2017 20:02:57 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id A889AC2216F;\n\tSun, 24 Sep 2017 19:59:00 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid A0D40C22153; Sun, 24 Sep 2017 19:58:17 +0000 (UTC)","from mout.gmx.net (mout.gmx.net [212.227.17.22])\n\tby lists.denx.de (Postfix) with ESMTPS id B5799C220B8\n\tfor <u-boot@lists.denx.de>; Sun, 24 Sep 2017 19:58:14 +0000 (UTC)","from workstation4.fritz.box ([84.118.154.110]) by mail.gmx.com\n\t(mrgmx102 [212.227.17.174]) with ESMTPSA (Nemesis) id\n\t0MJmcS-1dxIxV2fUi-001BmU; Sun, 24 Sep 2017 21:57:33 +0200"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-0.7 required=5.0 tests=FREEMAIL_FROM,\n\tRCVD_IN_DNSWL_LOW,\n\tRCVD_IN_MSPIKE_H2 autolearn=unavailable autolearn_force=no\n\tversion=3.4.0","From":"Heinrich Schuchardt <xypron.glpk@gmx.de>","To":"Alexander Graf <agraf@suse.de>","Date":"Sun, 24 Sep 2017 21:57:13 +0200","Message-Id":"<20170924195716.3433-15-xypron.glpk@gmx.de>","X-Mailer":"git-send-email 2.14.1","In-Reply-To":"<20170924195716.3433-1-xypron.glpk@gmx.de>","References":"<20170924195716.3433-1-xypron.glpk@gmx.de>","X-Provags-ID":"V03:K0:uuTqyTjLHKlZhKI8GXkv3wax4LnNGb3a4P0YFmbL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Pf76eqAz6qlHNNA0DsavdXj\n\thFih3CHjUS8kstLfXI9MyYAWD3EBg==","Cc":"Heinrich Schuchardt <xypron.glpk@gmx.de>, u-boot@lists.denx.de","Subject":"[U-Boot] [PATCH 14/17] efi_loader: fill return values in\n\tSimpleNetworkProtocol","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"},"content":"In the receive function all return values should be filled.\n\nSigned-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>\n---\n lib/efi_loader/efi_net.c | 27 +++++++++++++++++++++++++--\n 1 file changed, 25 insertions(+), 2 deletions(-)","diff":"diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c\nindex 5344210fff..e5faa3386e 100644\n--- a/lib/efi_loader/efi_net.c\n+++ b/lib/efi_loader/efi_net.c\n@@ -203,6 +203,10 @@ static efi_status_t EFIAPI efi_net_receive(struct efi_simple_network *this,\n \t\tstruct efi_mac_address *src_addr,\n \t\tstruct efi_mac_address *dest_addr, u16 *protocol)\n {\n+\tstruct ethernet_hdr *eth_hdr;\n+\tsize_t hdr_size = sizeof(struct ethernet_hdr);\n+\tu16 protlen;\n+\n \tEFI_ENTRY(\"%p, %p, %p, %p, %p, %p, %p\", this, header_size,\n \t\t  buffer_size, buffer, src_addr, dest_addr, protocol);\n \n@@ -210,13 +214,32 @@ static efi_status_t EFIAPI efi_net_receive(struct efi_simple_network *this,\n \n \tif (!new_rx_packet)\n \t\treturn EFI_EXIT(EFI_NOT_READY);\n-\n+\t/* Check that we at least received an Ethernet header */\n+\tif (net_rx_packet_len < sizeof(struct ethernet_hdr)) {\n+\t\tnew_rx_packet = false;\n+\t\treturn EFI_EXIT(EFI_NOT_READY);\n+\t}\n+\t/* Fill export parameters */\n+\teth_hdr = (struct ethernet_hdr *)net_rx_packet;\n+\tprotlen = ntohs(eth_hdr->et_protlen);\n+\tif (protlen == 0x8100) {\n+\t\thdr_size += 4;\n+\t\tprotlen = ntohs(*(u16 *)&net_rx_packet[hdr_size - 2]);\n+\t}\n+\tif (header_size)\n+\t\t*header_size = hdr_size;\n+\tif (dest_addr)\n+\t\tmemcpy(dest_addr, eth_hdr->et_dest, ARP_HLEN);\n+\tif (src_addr)\n+\t\tmemcpy(src_addr, eth_hdr->et_src, ARP_HLEN);\n+\tif (protocol)\n+\t\t*protocol = protlen;\n \tif (*buffer_size < net_rx_packet_len) {\n \t\t/* Packet doesn't fit, try again with bigger buf */\n \t\t*buffer_size = net_rx_packet_len;\n \t\treturn EFI_EXIT(EFI_BUFFER_TOO_SMALL);\n \t}\n-\n+\t/* Copy packet */\n \tmemcpy(buffer, net_rx_packet, net_rx_packet_len);\n \t*buffer_size = net_rx_packet_len;\n \tnew_rx_packet = false;\n","prefixes":["U-Boot","14/17"]}