From patchwork Fri Nov 30 22:45:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 152610 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp4211895ljp; Fri, 30 Nov 2018 14:45:51 -0800 (PST) X-Google-Smtp-Source: AFSGD/Vyon+r+NJdIMntR3izM6oRIC7P8pi3ViUSgrPFZCmC0zEcj75Ap2EG0DuowL9GwBnwxQxA X-Received: by 2002:a63:a611:: with SMTP id t17mr6223338pge.338.1543617951101; Fri, 30 Nov 2018 14:45:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543617951; cv=none; d=google.com; s=arc-20160816; b=uii8ARE84xSbZJFP8JKbHqt2C5Ma8bgugcq7l7IbwsAP5//IE+5sC6+ZISw4frf7n5 iLrUf+oDA3c/gjHh2WuNZNbLxdLS/GFEj/tDe5ZpLp9aBq9d+Ry0eQ6/rKNZA9iTyaR5 vEt9U53g6SF+2eJrCThD/HDrRjrlIkfu7UgyJhjC6jQbmoxXgxw5wr71jsuKyR0uNp8Y C2B8bhs4VfmX+tQJbFVkhPTSNh5XmnDDrl2FMPrGNJry3vmTV2xnCJ6bfdbV3MhVjWxE t4NeqQ1TN5id2bMLCxka46nSLUFlGCUdJ6Zk2h5khi0rfIm3MLWgz878M5mU2miv2SK1 unWA== 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=wAJtXstO94GDGYN3Y5vfr6RfqJzGwl9GO1EjJFfY5SU=; b=Mg5A5xiQgk3wZ/kNsaSXqJpoRJiU+U/aCf82Bs7valZO4R5gtlOUTpcShzeyh2T7dg w6g5haicjbqIKjm3ewkLbk8F7yKI07paAs/i4WKyUyabqlTRbFYSOKXvxJ7gY7Ss6qNa Y2eC7P4pYLUAv1gdiJDoITZgs3yG8LWWotNXjJY2PSqHcCQBdqIXBgJHmhu9xjr0Mxvh KPcAqguQUvny7TWOSOXAJNPnORihXb+nFdUwfAnFG2PhTEnRy+2kz4epqv3iQm5UxzD3 fxrQg5GsUBVGsfkBoSQoX1ReLnfbXC7xKuH149SyOyXwb1WT+OXomu2tq0Hm5q+HwN3s Gyeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=iA9bGTxS; 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 m8si5894767pgd.555.2018.11.30.14.45.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Nov 2018 14:45:51 -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=iA9bGTxS; 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 A750221196812; Fri, 30 Nov 2018 14:45:48 -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::343; helo=mail-wm1-x343.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) (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 09D12211963EE for ; Fri, 30 Nov 2018 14:45:46 -0800 (PST) Received: by mail-wm1-x343.google.com with SMTP id s14so452975wmh.1 for ; Fri, 30 Nov 2018 14:45:45 -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=MpSBFKlR4smrBKLvtNuyjJGH/qSXgZ34/9H4jX8KUMw=; b=iA9bGTxSWRNC1E0X8Hg8uFrC9Q344wLYwu8vyfLiJHUtc8/Mc+/eSWK9fnQfBdoo47 cGxh6Z0tAW2WPxvmUAPAGpVrPjKbriQWVW8DBMjp+IdjuOqp2ipivJuyZV9ep7JdUYd7 /YsMKu1L6hecP57dQLKmiO4rCNcHJ9krWVtFc= 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=MpSBFKlR4smrBKLvtNuyjJGH/qSXgZ34/9H4jX8KUMw=; b=pPxkEuH5Ru0p62MVu5YoYRftW2uGulOEgHKzdQyVSEMrysSFQa3T/7Rb0RB6/rPzaY nNvAhzWm1Quy2lbvYzhr2aHTDyWhwrxFfVxlULxyvrIU6pfmC6Z1n40Y99zg/a25ageo ovcQZkYfAzLgatdIpDg93P3CR7m279sXeSBnyLUi42JKGs/ry3pJ+nsY5A3DXTHDv1ub goXW/Q9TYFnfvTNNiDh5WPyu/Vx28D+X6yOWoyZbGkzBIK+VFW4b6hUHfPbT6/jsLyBO SetwPCJ7I8BrXaRVGc+IBoUO/K+VB7v4cUMAYyaE3KPmVUiGeq8i4/XJH11jK+W06dJr 7JKA== X-Gm-Message-State: AA+aEWaeQE1GiGmOXNEC2g9c4WmPvCZf+/HnuAXhSWJrMdtTK4KjETOd TQVh7xT1TMfp9LsmNVsWuz+Veoo/Se8= X-Received: by 2002:a1c:f605:: with SMTP id w5mr535985wmc.116.1543617944229; Fri, 30 Nov 2018 14:45:44 -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.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Nov 2018 14:45:43 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Fri, 30 Nov 2018 23:45:33 +0100 Message-Id: <20181130224537.18936-3-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 2/6] BaseTools/CommonLib: use explicit 64-bit type in Strtoi() 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" Don't use the native word size string to number parsing routines, but instead, use the 64-bit one and cast to UINTN. Currently, the only user is in Source/C/DevicePath/DevicePathFromText.c which takes care to use Strtoi64 () unless it assumes the value fits in 32-bit, so this change is a no-op even on 32-bit build hosts. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Jaben Carsey --- BaseTools/Source/C/Common/CommonLib.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: Philippe Mathieu-Daudé Reviewed-by: Laszlo Ersek diff --git a/BaseTools/Source/C/Common/CommonLib.c b/BaseTools/Source/C/Common/CommonLib.c index 7c559bc3c222..4a28f635f3a8 100644 --- a/BaseTools/Source/C/Common/CommonLib.c +++ b/BaseTools/Source/C/Common/CommonLib.c @@ -2252,9 +2252,9 @@ Strtoi ( ) { if (IsHexStr (Str)) { - return StrHexToUintn (Str); + return (UINTN)StrHexToUint64 (Str); } else { - return StrDecimalToUintn (Str); + return (UINTN)StrDecimalToUint64 (Str); } }