Re: [PATCH 2/2] arm64: error out if kernel command line is too long

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

 



On Tue, Jun 26, 2018 at 12:47:29PM -0700, Munehisa Kamata wrote:
> Currently, in arm64, kexec silently truncates kernel command line longer
> than COMMAND_LINE_SIZE - 1. Error out in that case as some other
> architectures already do that. The error message is copied from x86_64.
> 
> Suggested-by: Tom Kirchner <tjk@xxxxxxxxxx>
> Signed-off-by: Munehisa Kamata <kamatam@xxxxxxxxxx>
> ---
>  kexec/arch/arm64/kexec-arm64.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)


Hi,

This looks fine to me but I will wait to see if there are other reviews
before applying.

Reviewed-by: Simon Horman <horms@xxxxxxxxxxxx>

> 
> diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
> index 62f3758..8200064 100644
> --- a/kexec/arch/arm64/kexec-arm64.c
> +++ b/kexec/arch/arm64/kexec-arm64.c
> @@ -536,8 +536,15 @@ int arm64_load_other_segments(struct kexec_info *info,
>  	char command_line[COMMAND_LINE_SIZE] = "";
>  
>  	if (arm64_opts.command_line) {
> +		if (strlen(arm64_opts.command_line) >
> +		    sizeof(command_line) - 1) {

> +			fprintf(stderr,
> +				"Kernel command line too long for kernel!\n");
> +			return EFAILED;
> +		}
> +
>  		strncpy(command_line, arm64_opts.command_line,
> -			sizeof(command_line));
> +			sizeof(command_line) - 1);
>  		command_line[sizeof(command_line) - 1] = 0;
>  	}
>  
> -- 
> 2.7.4
> 
> 
> _______________________________________________
> kexec mailing list
> kexec@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/kexec
> 

_______________________________________________
kexec mailing list
kexec@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/kexec



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux