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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to