[PATCH 2/2] kernel image probe function return value checking fix

Simon Horman horms at verge.net.au
Thu Feb 6 02:30:56 EST 2014


On Thu, Feb 06, 2014 at 02:30:44PM +0800, Dave Young wrote:
> Currently kexec will use the kernel image type when probe function return
> value >=0. It looks odd, but previously it works. Since commit bf06cf2095
> it does not work anymore.
> 
> During my testing for arm zImage, in 2nd kernel the atags pointer and the
> machine_id are not valid, I did a lot of debugging in kernel, finally I found
> this is caused by a kexec tools bug instead.
> 
> Because uImage will be probed before zImage, also the uImage probe return 1
> instead of -1 since bf06cf2095, thus kexec will mistakenly think it is uImage.
> 
> Fix this issue by regarding it's valid only when probe return 0.
> 
> Signed-off-by: Dave Young <dyoung at redhat.com>

Thanks, applied.

> ---
>  kexec/kexec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kexec/kexec.c b/kexec/kexec.c
> index f13e512..703d524 100644
> --- a/kexec/kexec.c
> +++ b/kexec/kexec.c
> @@ -691,7 +691,7 @@ static int my_load(const char *type, int fileind, int argc, char **argv,
>  	}
>  	if (!type || guess_only) {
>  		for (i = 0; i < file_types; i++) {
> -			if (file_type[i].probe(kernel_buf, kernel_size) >= 0)
> +			if (file_type[i].probe(kernel_buf, kernel_size) == 0)
>  				break;
>  		}
>  		if (i == file_types) {
> -- 
> 1.8.3.1
> 



More information about the kexec mailing list