From patchwork Fri Nov 30 22:45:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 152612 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp4211977ljp; Fri, 30 Nov 2018 14:45:57 -0800 (PST) X-Google-Smtp-Source: AFSGD/US/czX+At+HQw6Mngpo61xVVBhnMC39U0NVJJMAz1ghAmP481An2lC/kiRmWh372IqzFzH X-Received: by 2002:a17:902:4124:: with SMTP id e33mr7380464pld.236.1543617957462; Fri, 30 Nov 2018 14:45:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543617957; cv=none; d=google.com; s=arc-20160816; b=MB0Yx32Czdt3iGT317km11zarfzRq2SHa1fp0pSvyQH+QGYxnd26Rjlql5smfxDHZP z27/xNK28fBQt07T+65APm0mFfvDc/RmxNYaFvOeIVvFAMhlRZLTt+248v8wNYarlMFl TK/mqQ25Vxi6ieTF2uNysdWPjIs8sR2wS3I7fHESbwmTFUB0RlS/Lxa6jkTHyNeqAKyN KvN0H1vaOr5QzohYFoUcJDMdWXOb4XjT7o1vCq40eq/i4gDA8ACa+H1wCXAmErumMa3l H0J5i4nQMDdOQWxj/N26FxMws5POegAPPQfhEcnqrwzukbfoA4LptMFDH2oo5ZSoTPHn dwSg== 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=RbU876kS9Gxa3WFMM9Gje2OrsbECfLZmTRPxuWW3lw4=; b=U+mOwE/chHg8oFusPF7wao48JNEPPlRDgJnQ9WzqaNQlyuKaoa7/WjD/BweduXFsfs eP/Sw8S+EX3LX9SpH1LlM65dYUYUerqCFMjrGZ9o/0uzmPGPURRwSphTN1uJKdsEcdHx 2K4qmzz9hGMJadRYqBnh5GsSy+krQvWEDvA/IwZUPnTQ5wudpZfuy7Uznkce10Xx0E8+ 1x5ZDofIu5U0Q8GybmhdBrpzh3mwinLx8G4R7r/lP3XhPjKMFWjdCkhmpz5VEkxjON90 UXKxG4wKjzyufMJ8ZZcTj7LlBR052/6eNg63mtRoQAZBN7ICnIWQZVNkEeeqslfVP2Vh dMQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=b2qGzKag; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 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. [198.145.21.10]) by mx.google.com with ESMTPS id a64si5898021pge.124.2018.11.30.14.45.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Nov 2018 14:45:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=b2qGzKag; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 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 2234C21196821; Fri, 30 Nov 2018 14:45:51 -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::342; helo=mail-wm1-x342.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) (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 BA82621196819 for ; Fri, 30 Nov 2018 14:45:48 -0800 (PST) Received: by mail-wm1-x342.google.com with SMTP id z18so441410wmc.4 for ; Fri, 30 Nov 2018 14:45:48 -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=Jgs2V5O+dhgteZihKktsPhM4fWU24XfBsoeNTGnMH7s=; b=b2qGzKagXdKIU9PBOY8Ow+kzKOYF6YblqbW7v2os16sN2Ka4umfDcw96RWzk2T97Ll AeQT5IcSL4oFT1Zf8JDWatyeifmKCAZV66XMgkmId8W6cZHyCz2J3nDiZ/hhBgSp2xDG xZX7elUZJcdwTph4YsoiaBAfmp9vjOKoxREeA= 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=Jgs2V5O+dhgteZihKktsPhM4fWU24XfBsoeNTGnMH7s=; b=r2piVMJPujIafht97me5l8s4Z56zwr/Y6CIffCh19RJtyob94P5iRgsWjQBof7M4BQ 0hMIWaPENDm1EkW0RQHu2BHebtTkO18G5YN4W3gmKJa62hoiiDIukbO7Sz0vmTn0InHp vk7TOwS5t1nDXmkQKQbu4YfuEl+lRG+G9yu5GCMFxhWj6pmXfeO4UpwbfNMlU94i6WrY rg7z2/WxWMOLlmMyvp4qicO7ViALNM74kZ8TY3InacJknk7v3EmtqLV+hCOdYDToEDof 6JHd7uCPoF4UJSxGGb2VT3oXDgM33vrctKplmwt+Cp3g7EbFlq6j3a21v8e8wt2lrsev s03Q== X-Gm-Message-State: AA+aEWb+kSJ+eWQbwX59McZ7bjekFwO6Ztnzyp0Y2IF7OMgXgRlK89i0 7YMvmi5eKnyseDAAl6fGTGrbnXgZIQc= X-Received: by 2002:a1c:150d:: with SMTP id 13mr510948wmv.104.1543617946912; Fri, 30 Nov 2018 14:45:46 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:d895:e032:7b00:86cd]) by smtp.gmail.com with ESMTPSA id m6sm10561195wrv.24.2018.11.30.14.45.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Nov 2018 14:45:46 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Fri, 30 Nov 2018 23:45:35 +0100 Message-Id: <20181130224537.18936-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181130224537.18936-1-ard.biesheuvel@linaro.org> References: <20181130224537.18936-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [edk2] [PATCH v2 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: Liming Gao , Jaben Carsey , Laszlo Ersek 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 Reviewed-by: Jaben Carsey --- 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: Laszlo Ersek 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;