public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Kent Yoder <key@linux.vnet.ibm.com>
Cc: James Morris <jmorris@namei.org>,
	linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	tpmdd-devel@lists.sourceforge.net,
	kernel-janitors@vger.kernel.org,
	Fengguang Wu <fengguang.wu@intel.com>
Subject: Re: [PATCH] tpm: fix tpm_acpi sparse warning on different address spaces
Date: Sun, 2 Sep 2012 09:30:30 -0700	[thread overview]
Message-ID: <20120902163030.GB1840@mwanda> (raw)
In-Reply-To: <20120830192155.GA25524@linux.vnet.ibm.com>

On Thu, Aug 30, 2012 at 02:21:55PM -0500, Kent Yoder wrote:
> On Thu, Aug 30, 2012 at 10:45:56AM -0700, Dan Carpenter wrote:
> > On Thu, Aug 30, 2012 at 09:38:41AM -0500, Kent Yoder wrote:
> > > acpi_os_map_memory expects its return value to be in the __iomem address
> > > space. Cast it back later when used in a memcpy to avoid the same sparse
> > > warning there.
> > > 
> > > Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
> > 
> > I can't download linux-next right now but I don't think this is the
> > correct fix.  I don't think you can memcpy() directly from __iomem.
> > The static checker is warning about a valid bug which should be
> > addressed instead of just casted away and silenced.
> 
>   I took a look at other uses of the return from acpi_os_map_memory(),
> such as acpi_tb_parse_fadt(), which passes the returned pointer to
> acpi_tb_create_local_fadt(), which uses ACPI_MEMCPY on it, which is just
> memcpy.  This code lives in drivers/acpi.
> 

Sparse finds that bug as well.  ;)

drivers/acpi/acpica/tbfadt.c:247:15: warning: incorrect type in assignment (different address spaces)
drivers/acpi/acpica/tbfadt.c:247:15:    expected struct acpi_table_header *table
drivers/acpi/acpica/tbfadt.c:247:15:    got void [noderef] <asn:2>*
drivers/acpi/acpica/tbfadt.c:266:30: warning: incorrect type in argument 1 (different address spaces)
drivers/acpi/acpica/tbfadt.c:266:30:    expected void [noderef] <asn:2>*logical_address
drivers/acpi/acpica/tbfadt.c:266:30:    got struct acpi_table_header *table

It should be memcpy_fromio() probably.

regards,
dan carpenter


  reply	other threads:[~2012-09-02 16:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-30 14:38 [PATCH] tpm: fix tpm_acpi sparse warning on different address spaces Kent Yoder
2012-08-30 17:45 ` Dan Carpenter
2012-08-30 19:21   ` Kent Yoder
2012-09-02 16:30     ` Dan Carpenter [this message]
2012-09-04 16:13       ` Kent Yoder
2012-09-04 16:18       ` Kent Yoder
2012-09-12  3:12         ` James Morris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120902163030.GB1840@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=fengguang.wu@intel.com \
    --cc=jmorris@namei.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=key@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=tpmdd-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox