Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7061590ybi; Thu, 13 Jun 2019 08:56:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqyaB0zpTvEemsJs54FWlaffL1TlczBr6/7iYy4bgX/oVmrY0kQ5H7D6bZNRfk1pmvlvml8+ X-Received: by 2002:a62:5e06:: with SMTP id s6mr96673158pfb.193.1560441378203; Thu, 13 Jun 2019 08:56:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560441378; cv=none; d=google.com; s=arc-20160816; b=QU9nLndx4MunfpP3CWKGuu5ScQnyBSYbrLKg83mzpX38Eo6yH0Eqg23LA0ah1AL2s1 hylVLD06uczKgwk9Tgr7ZIhZrjr8eisIcqzhR4WufjUtNsncHjmX4wP8zBNbGOT/TXXF eVgECm3Tqm9nMp+KDC+MDt9G9y45MKr+Mfx2KDnmoHBuNmBwUFHgp7afDu74miLKzPeX 07thZ4BWqMyna8Sn+5Pr0DWfxCujPD2eosJoUhHFAb9OHOl+0W/0QkJSO+oJpO97jgbw EImxyVSCR8d1klLmtZcV5R501yM0X64DRDcm95Lf5bT7J905CbwDMLos1/YWUNo4a10O j8+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=n7PArDXUl7LOBVHDgdyyLrxHdLxjO1IqwghuUIhjgcI=; b=aey4DtyGqEeriIbOuDhlAHjnRmA8XdB1B7BmTtd4AmGsaVpPA/sE2SWH5fHng3VdKe piLKGKCx/br9iG90cVqIJ7LGc5KVd/CIygVhvm+iIJE0ebLDeZ0lDDMw8OKc0H/k6hI6 KaRrRZ8u8ZL3hXPL939/iBHdGfhqOLFwgZyOtge0fUic0PSt85YXhP92Sg/RQrQ94xT2 QDYSiaIJEMU8snYCQo3UiLZkeQEFALuSUkWjTZKtWeOeQjkNGU++eG1eu5ZPiuqiU4qe xLb+9518niE/p4538XLwyXbJIs0ZfePSbojjVrGe+jHdrrB/lBcE319MAD/EOUrCz3z2 hJVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x3si109501pgr.22.2019.06.13.08.56.03; Thu, 13 Jun 2019 08:56:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389907AbfFMPyG (ORCPT + 99 others); Thu, 13 Jun 2019 11:54:06 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:44846 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731583AbfFMIzv (ORCPT ); Thu, 13 Jun 2019 04:55:51 -0400 Received: by mail-qt1-f195.google.com with SMTP id x47so21609711qtk.11; Thu, 13 Jun 2019 01:55:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=n7PArDXUl7LOBVHDgdyyLrxHdLxjO1IqwghuUIhjgcI=; b=d2hn+aLmeC3GeEaXUCxbRm6Xh48sTjGT+zTdVYxP/SpuxyOzTsD6eFLT8i3onuPGVH S+oHZLiiY0FWVbHHfxY71k2+8X8wgQMpbPxUBwhivXFHxbv4jYVxKNGlH0cH+lW3uGRE VkU1OlRcR5TOaKZRg3oFAI2n9LSV6S2CZlxT+cDsk0tQARhQB90oBdBsFQSXw+tMsZfg HWy493u2K/yNlb52sMgGP8fi9hva6oZs57/Ra/me9pPfyyrLJqMNZkalvlWbagK3kqwq R6Rf4nLrAKXT7iZzYvP5HjOZnmgo0I+guXW8zmo/p11iwEaORS6udSj5yjyY+80vzyk0 UZvQ== X-Gm-Message-State: APjAAAUuuM+/7gyAFr6WKLYUrtWBpJNWII/QKZ3VOG4wkXa4qykH05tj PsJq2Tn2FHe0+TctyDgBJBGzx41TPewNwToPd1Q= X-Received: by 2002:a0c:8b49:: with SMTP id d9mr2445970qvc.63.1560416149917; Thu, 13 Jun 2019 01:55:49 -0700 (PDT) MIME-Version: 1.0 References: <20190611125904.1013-1-cai@lca.pw> In-Reply-To: <20190611125904.1013-1-cai@lca.pw> From: Arnd Bergmann Date: Thu, 13 Jun 2019 10:55:33 +0200 Message-ID: Subject: Re: [PATCH -next] efi/tpm: fix a compilation warning To: Qian Cai Cc: Ard Biesheuvel , mjg59@google.com, linux-efi , bsz@semihalf.com, Jarkko Sakkinen , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 11, 2019 at 3:59 PM Qian Cai wrote: > > The linux-next "tpm: Reserve the TPM final events table" [1] introduced > a compilation warning, > > drivers/firmware/efi/tpm.c: In function 'efi_tpm_eventlog_init': > drivers/firmware/efi/tpm.c:80:10: warning: passing argument 1 of > 'tpm2_calc_event_log_size' makes pointer from integer without a cast > [-Wint-conversion] > tbl_size = tpm2_calc_event_log_size(efi.tpm_final_log > drivers/firmware/efi/tpm.c:19:43: note: expected 'void *' but argument > is of type 'long unsigned int' > > Fix it by making a necessary cast for the argument 1 of > tpm2_calc_event_log_size(). > > [1] https://lore.kernel.org/linux-efi/20190520205501.177637-3-matthewgarrett@google.com/ > > Signed-off-by: Qian Cai I see the same build warning, but I don't think adding a cast here solves the problem: - efi.tpm_final_log is a physical address that gets passed into memremap() to return a pointer - tpm2_calc_event_log_size() takes a pointer argument and dereferences it. My best guess is that we should pass the output of memremap() here rather than the input: --- a/drivers/firmware/efi/tpm.c +++ b/drivers/firmware/efi/tpm.c @@ -75,7 +75,7 @@ int __init efi_tpm_eventlog_init(void) goto out; } - tbl_size = tpm2_calc_event_log_size(efi.tpm_final_log + tbl_size = tpm2_calc_event_log_size(final_tbl + sizeof(final_tbl->version) + sizeof(final_tbl->nr_events), final_tbl->nr_events, No idea if that is actually what was intended here, but it makes the code look more plausible. Arnd