Re: [cbootimage PATCH V2 2/5] Accept void pointer as input data type for get/set_value functions

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

 



On 04/08/2014 08:30 AM, Penny Chiu wrote:
> This change uses void * as input data type for
> cbootimage_soc_config.get/set_value and context_set_value functions.
> This makes the functions can accept various data types based on
> different tokens.

> diff --git a/src/set.c b/src/set.c

>  int context_set_value(build_image_context *context,

>  	case token_block_size:
> -		context->block_size = value;
> -		context->block_size_log2 = log2(value);
> +		context->block_size = *((u_int32_t *)value);
> +		context->block_size_log2 = log2(*((u_int32_t *)value));
>  
>  		if (context->memory != NULL) {
>  			printf("Error: Too late to change block size.\n");
>  			return 1;
>  		}
>  
> -		if (value != (u_int32_t)(1 << context->block_size_log2)) {
> +		if (*((u_int32_t *)value) != (u_int32_t)(1 << context->block_size_log2)) {

That could be context->block_size rather than *((u_int32_t *)value).

>  	case token_page_size:
> -		context->page_size = value;
> -		context->page_size_log2 = log2(value);
> +		context->page_size = *((u_int32_t *)value);
> +		context->page_size_log2 = log2(*((u_int32_t *)value));
>  		context->pages_per_blk= 1 << (context->block_size_log2- 
>  			context->page_size_log2);

I wonder why this case doesn't validate that page_size is a power of two
like the block_size does? Still, that's a pre-existing issue, so doesn't
block this patch. If you could send a patch to fix that, it would be
awesome.

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




[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux