From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4001:c0b::22b; helo=mail-it0-x22b.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-it0-x22b.google.com (mail-it0-x22b.google.com [IPv6:2607:f8b0:4001:c0b::22b]) (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 53569222CB33F for ; Tue, 26 Dec 2017 00:34:12 -0800 (PST) Received: by mail-it0-x22b.google.com with SMTP id z6so21797258iti.4 for ; Tue, 26 Dec 2017 00:39:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=96B/m/cCNlYcujSVH1hNoYKp0I2lOpXiWY1S4r13Rzo=; b=HtMmD8we8NpwPRErPz9LuLoDSpo1/UcSNiAdBon6YtFUHYzZ7kco8kupDqG773bzyN S1Xyh8Df0AyK6ZMerLWiTjUXlu/DAwVjWxYgGCSVUXn+QQIuOHdpm4jhjuShq4RZ0K/x qHvWNtfVReWTfkRqdk5ZXPlRKizwCaqquXWBU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=96B/m/cCNlYcujSVH1hNoYKp0I2lOpXiWY1S4r13Rzo=; b=JW9nf8KDaOkm8T4hQFTvh15fbD5p6OKf54FgClVIKSZTHPPLD10aDILFgd8KZQfNiM 7CvEtbl11xXOakUqlrrmzxSpxzpF6Vs38x/Lal8/tl6343+/tIHiTq0KQ9HJvxjFg6Ic 9F4UpYokFZw3sQ2/mM0WuCJG6GHRmu/rQMOMqqpiNEF/hGyk32Gehclp7o8x10ooAg6m hcQLI0RrRw5fyoDvMit3uq0GqY1HaF09B/lNsj+s4J8dWlQz6gqVhQ29lJDWA3f7/GHa +EHKogoXGGSPWI62QMBrLjsA8MrmgXGyT4xtd/4o9QMFlHsG6IRw+e3uWRR0ge76X3s7 x/Sw== X-Gm-Message-State: AKGB3mJo0UrD/gTTjx9WjO+JfO1p7YCp/1vt3Ye0Rh1gXgGWmfMNnbPF QJSreWiQIoSzHtAZ4tPlo9LzTW0ll2az14Tby+c2+Q== X-Google-Smtp-Source: ACJfBosBgEi8vKa476AbMYMMVnfEfwgO7qKuFQGhPrenH7Baj6xxJNVKxe6S6flvQmRsxQv+BPTrmzoNB4wKs6BQcsU= X-Received: by 10.36.55.138 with SMTP id r132mr31719339itr.34.1514277545645; Tue, 26 Dec 2017 00:39:05 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.52.14 with HTTP; Tue, 26 Dec 2017 00:39:05 -0800 (PST) In-Reply-To: <1514277384-6480-1-git-send-email-liming.gao@intel.com> References: <1514277384-6480-1-git-send-email-liming.gao@intel.com> From: Ard Biesheuvel Date: Tue, 26 Dec 2017 08:39:05 +0000 Message-ID: To: Liming Gao Cc: "edk2-devel@lists.01.org" , Star Zeng Subject: Re: [Patch] MdeModulePkg Variable: Update Pointer Minus with UINTN type X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Dec 2017 08:34:12 -0000 Content-Type: text/plain; charset="UTF-8" On 26 December 2017 at 08:36, Liming Gao wrote: > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Liming Gao > Cc: Star Zeng Could you please add an explanation why this is necessary? Do we really need 5 (!) casts to perform a simple subtraction? > --- > MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > index 77905a0..a47270a 100644 > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > @@ -4125,7 +4125,7 @@ ConvertNormalVarStorageToAuthVarStorage ( > // > AuthVarStorage->Format = NormalVarStorage->Format; > AuthVarStorage->State = NormalVarStorage->State; > - AuthVarStorage->Size = (UINT32) (UINTN) ((UINT8 *) AuthStartPtr - (UINT8 *) AuthVarStorage); > + AuthVarStorage->Size = (UINT32)((UINTN) (UINT8 *) AuthStartPtr - (UINTN) (UINT8 *) AuthVarStorage); > CopyGuid (&AuthVarStorage->Signature, &gEfiAuthenticatedVariableGuid); > ASSERT (AuthVarStorage->Size <= AuthVarStroageSize); > > -- > 2.8.0.windows.1 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel