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 <[email protected]>
---
drivers/char/tpm/tpm_acpi.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/char/tpm/tpm_acpi.c b/drivers/char/tpm/tpm_acpi.c
index fe3fa94..36bdcfa 100644
--- a/drivers/char/tpm/tpm_acpi.c
+++ b/drivers/char/tpm/tpm_acpi.c
@@ -49,7 +49,7 @@ int read_log(struct tpm_bios_log *log)
{
struct acpi_tcpa *buff;
acpi_status status;
- struct acpi_table_header *virt;
+ void __iomem *virt;
u64 len, start;
if (log->bios_event_log != NULL) {
@@ -102,7 +102,7 @@ int read_log(struct tpm_bios_log *log)
return -EIO;
}
- memcpy(log->bios_event_log, virt, len);
+ memcpy(log->bios_event_log, (void *)virt, len);
acpi_os_unmap_memory(virt, len);
return 0;
--
1.7.5.4
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 <[email protected]>
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.
regards,
dan carpenter
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 <[email protected]>
>
> 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.
Kent
>
> regards,
> dan carpenter
>
>