Re: [PATCH] tpm: fix tpm_acpi sparse warning on different address spaces

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxx>
> > 
> > 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

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux