ACK: [PATCH 5/5] lib: fwts_multiproc: avoid using void * pointer arithmetic

Alex Hung alex.hung at canonical.com
Tue Sep 16 02:15:49 UTC 2014


On 14-09-11 10:05 PM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> cppcheck reports:
>     When using void pointers in calculations, the behaviour is undefined
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>   src/lib/src/fwts_multiproc.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/lib/src/fwts_multiproc.c b/src/lib/src/fwts_multiproc.c
> index 2d17948..69084e9 100644
> --- a/src/lib/src/fwts_multiproc.c
> +++ b/src/lib/src/fwts_multiproc.c
> @@ -78,7 +78,7 @@ static int fwts_mp_get_address(uint32_t *phys_addr)
>   		if ((mem = fwts_mmap(start, size)) == FWTS_MAP_FAILED)
>   			continue;
>   
> -		for (ptr = mem; ptr < (uint8_t*)(mem + size); ptr+=16) {
> +		for (ptr = mem; ptr < (uint8_t*)mem + size; ptr+=16) {
>   			if ((*ptr == '_') &&
>   			    (*(ptr + 1) == 'M') &&
>   			    (*(ptr + 2) == 'P') &&
> @@ -176,7 +176,7 @@ int fwts_mp_data_get(fwts_mp_data *data)
>   			tmp += sizeof(fwts_mp_compat_bus_address_space_entry);
>   			break;
>   		default:
> -			tmp = mem + data->size; /* Force abort */
> +			tmp = (uint8_t *)mem + data->size; /* Force abort */
>   			break;
>   		}
>   	}

Acked-by: Alex Hung <alex.hung at canonical.com>



More information about the fwts-devel mailing list