From patchwork Tue Sep 29 11:02:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 263232 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9124FC4727F for ; Tue, 29 Sep 2020 11:49:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 44F92206F7 for ; Tue, 29 Sep 2020 11:49:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601380141; bh=jHWn/Vris5ab3EyU7q0T+C5BBCMEeASBeyK4+7BStbY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=OoUF9PhhgSaX1f3AxAzlkfaP0uQEkkz0/PXoQDoeSF9rIJZk9N15jSf9cbosS5ucC Mxeocm7bZXjBzAYdrpBWHoNrA4jbJDNQ4oeY7WzPeWTvwDplNAv6cJkN/9Xa27iYnc XSzxh137+ZimQ8Ily++z0MHjImu1tG6RJrxxRI7o= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730328AbgI2LtA (ORCPT ); Tue, 29 Sep 2020 07:49:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:51862 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729955AbgI2Ls6 (ORCPT ); Tue, 29 Sep 2020 07:48:58 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D6B672083B; Tue, 29 Sep 2020 11:48:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601380138; bh=jHWn/Vris5ab3EyU7q0T+C5BBCMEeASBeyK4+7BStbY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1646tCpskLVMLCKYvjlBTflCDU28BnyUPBA6Luwt0MRglfeHBlqEFp1kT/yERNJsw JiXqRFMw0ezVDh012MI2ozc8zoOeb2USpcDEhMOG5MF6dd2fsulZH7em88uwypNpFs 0x6Ymdg9qqx9nlBckln8PqoPRUuvgsmXyKN/S/T0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ingo Molnar , Masami Hiramatsu , "Steven Rostedt (VMware)" Subject: [PATCH 5.8 83/99] lib/bootconfig: Fix to remove tailing spaces after value Date: Tue, 29 Sep 2020 13:02:06 +0200 Message-Id: <20200929105933.822431869@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105929.719230296@linuxfoundation.org> References: <20200929105929.719230296@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Masami Hiramatsu commit c7af4ecdffe1537ba8aeed0ac12c3326f908df43 upstream. 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 Cc: stable@vger.kernel.org Signed-off-by: Masami Hiramatsu Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Greg Kroah-Hartman --- lib/bootconfig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/lib/bootconfig.c +++ b/lib/bootconfig.c @@ -486,8 +486,8 @@ static int __init __xbc_parse_value(char break; } if (strchr(",;\n#}", c)) { - v = strim(v); *p++ = '\0'; + v = strim(v); break; } }