From patchwork Mon Apr 16 05:59:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 898474 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40PdBR109zz9s0t for ; Mon, 16 Apr 2018 16:04:31 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id BFCEDC21E1E; Mon, 16 Apr 2018 06:01:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 81670C21E0F; Mon, 16 Apr 2018 05:59:27 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 36BCDC21BE5; Mon, 16 Apr 2018 05:59:19 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by lists.denx.de (Postfix) with ESMTPS id AD986C21C3F for ; Mon, 16 Apr 2018 05:59:19 +0000 (UTC) Received: from LPT2.fritz.box ([62.143.246.157]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0MSZ6u-1ey5oZ0wZ2-00RaYP; Mon, 16 Apr 2018 07:59:19 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Mon, 16 Apr 2018 07:59:07 +0200 Message-Id: <20180416055910.12611-6-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180416055910.12611-1-xypron.glpk@gmx.de> References: <20180416055910.12611-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K1:QNAupViUKZYoVX0nPtedkxMO6Z5nt5ubGX00vD7oH39iJUV/kKW 3v8c7dsDKyQ2wOLLxejPXUlv0BOhLDis7w5OLNvyue9Cq9Sk4n8WekJtpN68RaYSnhGbfLF NUxz6jQMalFRYVfOFg8hIz5Rt6/WiWzkhB7WM9XSwcnh5YBBaBoMbylXq6gBvx6QEWRRxio N8hh8NaC4r8wTQ6zG/icw== X-UI-Out-Filterresults: notjunk:1; V01:K0:MfWvqNK+ZVQ=:4V873bP5YeBzX6xMLjlWhA WyIl/A0veVOr5nJYJLuKOwD/md0spB1/nCbz/SAPhQP2BugjyjTjjUfOhVZF+AHhLnZrDv6Ws Clk2OB0d1naF5luD1ujAWQJw/zxZaMUGbGHVunfvM8EGC90xGzFBjEQqrnDTC9e9PGB/ZJBVb yatkoGHUcWi2jKlTY9ZRY5bQJ/bSNUQXm5vVXb63s/2c4yGdEpbCq1MzJrZPf2D82VqvkDrPP Yp7G2Bu+eigiL64C4wG7F62EsvONL3AQVE+flqGJQWz8oKQ4IY1y9TSyqvVe1yvnM2hy9Xpjx 56pJLJnkJKjc5YD4++N90UhCheCDyD0KR8uwfxOAsALTa6O4ImtxU0A+OeNgXBcWZgjNFxprc kiRwjOncZVedWHR3Xs7lGOgLR90hB9y2rpvLmWtRdGbv0Lu+GhUqSUScfwz4H8bSwPvonXVjy bgCLIsh0XgCYCJalqQKuUv8Kp4lmEYWwo2dmuvmbPK7s4w0S93pHoO+Auucd1bWGXzJTV2yuZ P0wQY2j5jKU/ZNRhAu1W870H12kpKfSaUGnDbM/EKfEHvGluLDJt6strpvABWcSWnAgY1osWP QGqytaduj5ivjNTKCxICKP8DvIiXINHOQRXeTycv8OvFMEkgW0zB9VR+msrrw60Dv0sc9b8SW 0SmbUeyBBXXUBqUXrZsHb3XaGQKezlTcmSvrrqhKeNi6PQUr2YyvNcq3clKWHgwD7s75NFVa5 PhqpLE2Fhhn0nbPVwrLsTJZZht32b1Ivg17PYU7hmdujl4MgbttjBuG30bpmfVJh3hxMHhBeF 2L1lB2BfnP8sWa1l9QXMHYAFWhnMA== Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v2 5/8] efi_loader: correctly determine length of empty device path X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" efi_dp_size() is meant to return the device path length without the end node. The length of a device path containing only an end node was incorrectly reported as 4. Signed-off-by: Heinrich Schuchardt --- v2 no change --- lib/efi_loader/efi_device_path.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index 531a754427..46d3fea732 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -234,6 +234,8 @@ unsigned efi_dp_size(const struct efi_device_path *dp) { unsigned sz = 0; + if (!dp || dp->type == DEVICE_PATH_TYPE_END) + return 0; while (dp) { sz += dp->length; dp = efi_dp_next(dp);