OSDN Git Service

mailbox: mailbox-test: Correctly repair Sparse warnings
authorLee Jones <lee.jones@linaro.org>
Tue, 20 Oct 2015 16:11:27 +0000 (17:11 +0100)
committerJassi Brar <jaswinder.singh@linaro.org>
Fri, 23 Oct 2015 05:49:21 +0000 (11:19 +0530)
commita133f8b65d591101e48336050ceb7e2f51026502
tree3189f4c3734e643f4ee30fc2bc7a3fdabbff968a
parent6c03663f98b91cdd04fce2c9fb7a2cc5d164eded
mailbox: mailbox-test: Correctly repair Sparse warnings

Kbuild test robot reported some Sparse warnings to the tune of:

  sparse: incorrect type in argument 6 (different address spaces)
    expected void const *buf
    got void [noderef] <asn:2>*mmio

This was due to passing variables tagged with the Sparse cookie
'__iomem' through into memcpy() and print_hex_dump() without
adequate protection or casting.  These issues were fixed in a
previous patch suppressing the warnings, but the issue is indeed
still present.

This patch fixes the warnings in the correct way, i.e. by using
the purposely authored memcpy_{from,to}io() derivatives in the
memcpy() case and casting the memory address to (void *) and
forcing Sparse to ignore to ignore it in the print_hex_dump()
case [NB: This is also what the memcpy() derivatives do].

Reported-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
drivers/mailbox/mailbox-test.c