Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7033868ybi; Thu, 13 Jun 2019 08:28:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqw5qYa+UQ7sY8Zi2+R4wKmoaK3Ctp+LO49zwUsE9DlzJ/8KvUQhTvIPlTgdPTrGFNx51sKR X-Received: by 2002:a17:902:28e9:: with SMTP id f96mr42024879plb.114.1560439690470; Thu, 13 Jun 2019 08:28:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560439690; cv=none; d=google.com; s=arc-20160816; b=YtPiCpbDc+mxQcmubiJoIgi9vH/yFOxMbi1MukA90rCamRJqmjjcsVyBlCPCsXdxzk Nglp+QzkOutiiTGA65FEDXIpmhmQNYEbVXTokwnu6KCPMU59uFqR5Y6ZKlsvqMVtJyG7 kjn+IozNZlZk13XAk5WEfaN0O+1M+37K6ng4WD13En0rfHN5fVASCVLWj3H4MKRR2B5f p7ob/N1n2yLXhRupKyMeJehtaLUYsAl1/8tZBj+fg2GXJyBIUXv7hQ8YrTDSQ8QOldSH yoJiAH+iIlJ8ajn3nNOJFCcNcZ/m72n9K3AxHVO7goyRSXNUr4drjN8zbAYaut5BO0Hg y1DA== 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:dkim-signature; bh=H4VyKD+1E4l8WEL9xPMuwhvlmL4tX+kahUY4NzXzOPg=; b=COHceJNKSjCclseaO4CIH4hB5NbEEFaob5d/WLQqIxy+g/H9cSrvU/ukdnEcuHuXUv gkF6V3Fk4Qo8Z7tEUEzI4xJd7rfNtHcjm8KPYyyz0D5N8SbteZehl16hMhgJGk++/6hM SO3n1rJGXE3JUtlDduiSORTnG++arU9p4pQlcgUJVhacWckUYxLp3DX4CmEUbqwtAJUs y9gI6lE2d/H4dSHfdmw3qjlGIP72PXLxgTUMPpQZEgu8RO3CTIl/fPcaE1pSoNunpSTk TsFTyXDj648/qwszIgTyAiscfO2Xnra40tEfDe7TRV6oPOIT13Cxxfn79Q680/FG3Mel uiig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@semihalf-com.20150623.gappssmtp.com header.s=20150623 header.b=GEPuNeYc; 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 g16si3487564pfi.31.2019.06.13.08.27.54; Thu, 13 Jun 2019 08:28:10 -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; dkim=pass header.i=@semihalf-com.20150623.gappssmtp.com header.s=20150623 header.b=GEPuNeYc; 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 S1728044AbfFMP1J (ORCPT + 99 others); Thu, 13 Jun 2019 11:27:09 -0400 Received: from mail-ua1-f67.google.com ([209.85.222.67]:35076 "EHLO mail-ua1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729075AbfFMLld (ORCPT ); Thu, 13 Jun 2019 07:41:33 -0400 Received: by mail-ua1-f67.google.com with SMTP id r7so7188243ual.2 for ; Thu, 13 Jun 2019 04:41:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=H4VyKD+1E4l8WEL9xPMuwhvlmL4tX+kahUY4NzXzOPg=; b=GEPuNeYcY/7A1PQYuYWpQnvhWJkLDdN+G4zM83miDSvxP35U8hvwvgmHn/DZ0jawal M6EZ+qGxSyPscR3LXUy3gax36GEgVhXh5uNmFOHWDXVTzw5+JQBr7bSXc3k1BRJCp+Yj eAohEXwqZSGCl+pkaevh8cWV8OnN72kHk9QghGe+Ry/zIfeFQhtgnYs9b0ZGXPfIxd1U ivRWDapr3eGWpgcnnypxlaGxd0NuLbWsUg9G7NO573oSG1ILxKvuiBzs9LFESq0KXfP/ aja32Rib05Mnat8HtkFr23HtdsduG5Cp5HpirNXqmkLSTSD0Lpgy1ydq/hJVXkZLfLno SipQ== 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=H4VyKD+1E4l8WEL9xPMuwhvlmL4tX+kahUY4NzXzOPg=; b=BmNA8V4wK9co15vQlqHZcRHvtLLxQLKQuqoxwrxBj6NJ6eclJnKJr6UHeyOpXtdmXt WGQ7dfCPpaDDQ1/M/k9a55VxBSIZk5KuEbTI7OaxyyTwLA+mhHAzpBC784l8EtuhDYuD H12SX4WAAZ+VWnDE/NUWRwu/jLcd3JZ1YLZ4ae40e+dVc11Vt7cGQw/NYt9XAZOr/nSg HkSXU42bA4M4/7s/NueWOO1vOLGfW1XlkS9RK9uPjmFJjgQMq0BqdABCfLyxVtn65GOS MdBqgtNwYpQK28tm7Z9KVLpnNjaOCFcoEx9nY7/sYB0vX6mPp7D44vVmgaceqBbz55pt HPcA== X-Gm-Message-State: APjAAAWHKlTGfGVRyZ1BxD+g7YQXjgA2IRGM1mPIfBOpAr7NgYs2h7nD Zp+iLT31P+fzt+E3bJigtdr5NIvD/Ij6hjwpyOzOog== X-Received: by 2002:ab0:168a:: with SMTP id e10mr33043256uaf.87.1560426092549; Thu, 13 Jun 2019 04:41:32 -0700 (PDT) MIME-Version: 1.0 References: <20190611125904.1013-1-cai@lca.pw> In-Reply-To: From: Bartosz Szczepanek Date: Thu, 13 Jun 2019 13:41:21 +0200 Message-ID: Subject: Re: [PATCH -next] efi/tpm: fix a compilation warning To: Arnd Bergmann Cc: Qian Cai , Ard Biesheuvel , Matthew Garrett , linux-efi , 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 Thu, Jun 13, 2019 at 10:55 AM Arnd Bergmann wrote: > > - 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. Where does it? It's passed with some added offset to __calc_tpm2_event_size, which does the remapping part. That's why physical address is used here. > 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. Passing final_tbl will lead to failure, as it will be remapped for second time. Cast is needed here. Changing the type from void* to unsigned long or phys_addr_t (and casting later) would also do the job. I'm fine with both options.