From patchwork Thu Nov 29 12:31:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 152400 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2320838ljp; Thu, 29 Nov 2018 04:31:50 -0800 (PST) X-Google-Smtp-Source: AFSGD/V1g8vRd1N2W38UnSY2WkARV6QBI1RsWfR+8LHOufKHPYKz3iaXtrD0jK4JotEc/pZADSj9 X-Received: by 2002:a63:4815:: with SMTP id v21mr1073951pga.308.1543494710818; Thu, 29 Nov 2018 04:31:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543494710; cv=none; d=google.com; s=arc-20160816; b=o+fJhUr1fQ9IMpZHpe49qLn/YDRCSPzoVWmRrXtBzy8rqP6RJ79WU5yfn+usrl3aQz rtIGBY1F0bzzEcSl5WIRXYr8/03eV2JkbuKAeUbhxfqESmBlG7YhtvAcb4ZOJ2G+ZAnP OXPRX4cpn3CPoQmCTKtJM4EBBaecuUSbWBdpI0xOyejQn6OrribU/xBedw0vgtH7TZe8 qUv9jyYE7Vo5m/c4OD0xCPYlzNUFKGvzRo4QB5YTaPeoKosq9s6aHnqqPQhnhV85nedk 9El3SCqp+ngAJWKCA95fKr1/SDRSH8/AlIhCHaFkP8jg2n4ZRytSO8rCEtw5NdzF/SqG 5V9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=BzEZoLzLpOVzafj6WUTGx+Eps5GdiVLCms4ydUlbF1Q=; b=rWFvjdPe5GZFvkz1/z7QJjwtImRkOjITgfh0LhTS/evThqL6Dnn9LJ/LJTMb914nom yYSBx1eszCNp1RBAHpMl9sMQiG1o18G2svqnWmlnfYtq0bRHh4H8vhX92l1Ge14pMlSs w80RSYWVQ5svL5UA32fLcRvmuohLAcJoRqD1Onjzs27sguzdTIm544In8mA9M5N+mX7H Os21mEnf+WHqmGK2c3WxkfkCcSrrEn2b5PijTcpdaN5RAD4G+9S1QjBrgyXs+yB4NbFt PqaUZ2NTArBffvhgFFc+IJpkh4sIecQaenyGJ7X/xf2GPS2+sfVsKmaUJ7vlQ+TNMV8H 7POQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=aZCrAgnT; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id x8si2008859plo.259.2018.11.29.04.31.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Nov 2018 04:31:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=aZCrAgnT; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 0F4A1211963F6; Thu, 29 Nov 2018 04:31:44 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::442; helo=mail-wr1-x442.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4C394211963F0 for ; Thu, 29 Nov 2018 04:31:41 -0800 (PST) Received: by mail-wr1-x442.google.com with SMTP id l9so1700612wrt.13 for ; Thu, 29 Nov 2018 04:31:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=S+UbueAnN6mRAjftIfHNuxoTU6LNQJLEReQTkpWTQkQ=; b=aZCrAgnThVZkyB9YCuuWxGjzF1gxrj2FS+LF8m/6WQ10RnSYbebQiWnDPADv06hG0M LBulXzCgV79jVt/ll+mNlsAkXcE9YPmAEoJDKEXNv+YPL/OSILy4/BJjO1fUKbvH4XYw NFt4fBbOMA6zvutmqsMIJFrIJ0sYMVgzaECdY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S+UbueAnN6mRAjftIfHNuxoTU6LNQJLEReQTkpWTQkQ=; b=luiAdNp/cSz0UoSY3ms3fdQrAog9tclzBqeZdUB4wU1Sj9z7QFTcdPOE4IfENFxEjY iopumO+I9dCILDxHbwVcMKLlh5P1xiIEhhF9h3KT3aF44BlDDCcsDYTR+A3m2M8ZRQWr AzIxsnu0oDYWQ9s+7KmqFfslnXc2yIGlLscKSlXKYTgEV44+Mjz/SVDZCK4T3yHWa6g+ JEJThwWicYlrF9sBdiCmSE3ayi4b0E0+StJpthiNYbreR4p4tNqkTcz4v+Np9dUA5X7Q Ia5SLiEjpgqJc3pz0MXK9iILKrX0fPq/pBZ4C/XAacQKnD/cB2Y73C6m7/C91bCQqYHE HBZA== X-Gm-Message-State: AA+aEWbEYzcPvnGKPtVlJPrSUQlYEkOnbfhM1XyvKWyZbJrKOdZQukSm YqyBTMX5CVWXJhOZOxeivXFeSvajPx8= X-Received: by 2002:a5d:628a:: with SMTP id k10mr1223553wru.254.1543494699073; Thu, 29 Nov 2018 04:31:39 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:3580:6f80:40a7:5bdd]) by smtp.gmail.com with ESMTPSA id c7sm3089525wre.64.2018.11.29.04.31.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Nov 2018 04:31:38 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 29 Nov 2018 13:31:27 +0100 Message-Id: <20181129123129.25095-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181129123129.25095-1-ard.biesheuvel@linaro.org> References: <20181129123129.25095-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [edk2] [PATCH 4/6] BaseTools/DevicePath: use MAX_UINT16 as default device path max size X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laszlo Ersek , Liming Gao Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Replace the default size limit of IsDevicePathValid() with a value that does not depend on the native word size of the build host. 64 KB seems sufficient as the upper bound of a device path handled by UEFI. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- BaseTools/Source/C/DevicePath/DevicePathUtilities.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.19.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Jaben Carsey diff --git a/BaseTools/Source/C/DevicePath/DevicePathUtilities.c b/BaseTools/Source/C/DevicePath/DevicePathUtilities.c index d4ec2742b7c8..ba7f83e53070 100644 --- a/BaseTools/Source/C/DevicePath/DevicePathUtilities.c +++ b/BaseTools/Source/C/DevicePath/DevicePathUtilities.c @@ -62,7 +62,7 @@ IsDevicePathValid ( ASSERT (DevicePath != NULL); if (MaxSize == 0) { - MaxSize = MAX_UINTN; + MaxSize = MAX_UINT16; } // @@ -78,7 +78,7 @@ IsDevicePathValid ( return FALSE; } - if (NodeLength > MAX_UINTN - Size) { + if (NodeLength > MAX_UINT16 - Size) { return FALSE; } Size += NodeLength;