lkml.org 
[lkml]   [2020]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[for-linus][PATCH 2/4] lib/bootconfig: Fix to remove tailing spaces after value
    From: Masami Hiramatsu <mhiramat@kernel.org>

    Fix to remove tailing spaces after value. If there is a space
    after value, the bootconfig failed to remove it because it
    applies strim() before replacing the delimiter with null.

    For example,

    foo = var # comment

    was parsed as below.

    foo="var "

    but user will expect

    foo="var"

    This fixes it by applying strim() after removing the delimiter.

    Link: https://lkml.kernel.org/r/160068149134.1088739.8868306567670058853.stgit@devnote2

    Fixes: 76db5a27a827 ("bootconfig: Add Extra Boot Config support")
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
    Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
    ---
    lib/bootconfig.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/lib/bootconfig.c b/lib/bootconfig.c
    index b44bba0f1583..649ed44f199c 100644
    --- a/lib/bootconfig.c
    +++ b/lib/bootconfig.c
    @@ -494,8 +494,8 @@ static int __init __xbc_parse_value(char **__v, char **__n)
    break;
    }
    if (strchr(",;\n#}", c)) {
    - v = strim(v);
    *p++ = '\0';
    + v = strim(v);
    break;
    }
    }
    --
    2.28.0

    \
     
     \ /
      Last update: 2020-09-23 16:51    [W:4.416 / U:0.020 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site