diff mbox

ARM:boot: support the command with COMMAND_LINE_SIZE - 1 useful chars

Message ID 510912D5.5030505@asianux.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chen Gang Jan. 30, 2013, 12:32 p.m. UTC
originally, not support the command with COMMAND_LINE_SIZE - 1 useful chars.
  but in fact, we can support it:

Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 arch/arm/boot/compressed/atags_to_fdt.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Richard Genoud Jan. 30, 2013, 3:40 p.m. UTC | #1
On [mer., 30.01.2013 20:32:21], Chen Gang wrote:
> 
>   originally, not support the command with COMMAND_LINE_SIZE - 1 useful chars.
>   but in fact, we can support it:
> 
You're right.
Reviewed-by: Richard Genoud <richard.genoud@gmail.com>
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
>  arch/arm/boot/compressed/atags_to_fdt.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/boot/compressed/atags_to_fdt.c b/arch/arm/boot/compressed/atags_to_fdt.c
> index aabc02a..ed23ec2 100644
> --- a/arch/arm/boot/compressed/atags_to_fdt.c
> +++ b/arch/arm/boot/compressed/atags_to_fdt.c
> @@ -63,7 +63,7 @@ static void merge_fdt_bootargs(void *fdt, const char *fdt_cmdline)
>  	/* copy the fdt command line into the buffer */
>  	fdt_bootargs = getprop(fdt, "/chosen", "bootargs", &len);
>  	if (fdt_bootargs)
> -		if (len < COMMAND_LINE_SIZE) {
> +		if (len <= COMMAND_LINE_SIZE) {
>  			memcpy(ptr, fdt_bootargs, len);
>  			/* len is the length of the string
>  			 * including the NULL terminator */
> @@ -73,7 +73,7 @@ static void merge_fdt_bootargs(void *fdt, const char *fdt_cmdline)
>  	/* and append the ATAG_CMDLINE */
>  	if (fdt_cmdline) {
>  		len = strlen(fdt_cmdline);
> -		if (ptr - cmdline + len + 2 < COMMAND_LINE_SIZE) {
> +		if (ptr - cmdline + len + 2 <= COMMAND_LINE_SIZE) {
>  			*ptr++ = ' ';
>  			memcpy(ptr, fdt_cmdline, len);
>  			ptr += len;
> -- 
> 1.7.10.4
Chen Gang Feb. 1, 2013, 1:13 a.m. UTC | #2
? 2013?01?30? 23:40, Richard GENOUD ??:
> On [mer., 30.01.2013 20:32:21], Chen Gang wrote:
>> > 
>> >   originally, not support the command with COMMAND_LINE_SIZE - 1 useful chars.
>> >   but in fact, we can support it:
>> > 
> You're right.
> Reviewed-by: Richard Genoud <richard.genoud@gmail.com>

  ok, thank you.

  :-)
diff mbox

Patch

diff --git a/arch/arm/boot/compressed/atags_to_fdt.c b/arch/arm/boot/compressed/atags_to_fdt.c
index aabc02a..ed23ec2 100644
--- a/arch/arm/boot/compressed/atags_to_fdt.c
+++ b/arch/arm/boot/compressed/atags_to_fdt.c
@@ -63,7 +63,7 @@  static void merge_fdt_bootargs(void *fdt, const char *fdt_cmdline)
 	/* copy the fdt command line into the buffer */
 	fdt_bootargs = getprop(fdt, "/chosen", "bootargs", &len);
 	if (fdt_bootargs)
-		if (len < COMMAND_LINE_SIZE) {
+		if (len <= COMMAND_LINE_SIZE) {
 			memcpy(ptr, fdt_bootargs, len);
 			/* len is the length of the string
 			 * including the NULL terminator */
@@ -73,7 +73,7 @@  static void merge_fdt_bootargs(void *fdt, const char *fdt_cmdline)
 	/* and append the ATAG_CMDLINE */
 	if (fdt_cmdline) {
 		len = strlen(fdt_cmdline);
-		if (ptr - cmdline + len + 2 < COMMAND_LINE_SIZE) {
+		if (ptr - cmdline + len + 2 <= COMMAND_LINE_SIZE) {
 			*ptr++ = ' ';
 			memcpy(ptr, fdt_cmdline, len);
 			ptr += len;