From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033574AbdDTRu6 (ORCPT ); Thu, 20 Apr 2017 13:50:58 -0400 Received: from mga02.intel.com ([134.134.136.20]:35222 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033559AbdDTRus (ORCPT ); Thu, 20 Apr 2017 13:50:48 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,225,1488873600"; d="scan'208";a="76859718" Date: Thu, 20 Apr 2017 10:51:25 -0700 (PDT) From: Shivappa Vikas X-X-Sender: vikas@vshiva-Udesk To: Thomas Gleixner cc: Vikas Shivappa , vikas.shivappa@intel.com, x86@kernel.org, linux-kernel@vger.kernel.org, sai.praneeth.prakhya@intel.com, hpa@zytor.com, mingo@kernel.org, ravi.v.shankar@intel.com, tony.luck@intel.com, fenghua.yu@intel.com Subject: Re: [PATCH 2/3] x86/intel_rdt: Trim whitespace while parsing schemata input In-Reply-To: Message-ID: References: <1492645804-17465-1-git-send-email-vikas.shivappa@linux.intel.com> <1492645804-17465-3-git-send-email-vikas.shivappa@linux.intel.com> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 20 Apr 2017, Thomas Gleixner wrote: > On Wed, 19 Apr 2017, Vikas Shivappa wrote: > >> Schemata is displayed in tabular format which introduces some whitespace >> to show data in a tabular format. If user wants to input the same data >> that is displayed, the parsing fails. Trim the leading and trailing >> whitespace to help parse such data. >> >> Reported-by: Prakhya, Sai Praneeth >> Signed-off-by: Vikas Shivappa >> Tested-by: Prakhya, Sai Praneeth >> --- >> arch/x86/kernel/cpu/intel_rdt_schemata.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/arch/x86/kernel/cpu/intel_rdt_schemata.c b/arch/x86/kernel/cpu/intel_rdt_schemata.c >> index 9467a00..3cfa1ca 100644 >> --- a/arch/x86/kernel/cpu/intel_rdt_schemata.c >> +++ b/arch/x86/kernel/cpu/intel_rdt_schemata.c >> @@ -143,7 +143,7 @@ static int parse_line(char *line, struct rdt_resource *r) >> return -EINVAL; >> list_for_each_entry(d, &r->domains, list) { >> if (d->id == dom_id) { >> - if (r->parse_ctrlval(dom, r, d)) >> + if (r->parse_ctrlval(strim(dom), r, d)) >> return -EINVAL; >> goto next; >> } >> @@ -220,7 +220,7 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of, >> goto out; >> } >> for_each_enabled_rdt_resource(r) { >> - if (!strcmp(resname, r->name) && >> + if (!strcmp(strim(resname), r->name) && > > Both strims() invocations are just silly. They can be done before the loop > once instead of doing them over and over again. Will fix. I went overboard not wanting to add a line Thanks, Vikas > > Thanks, > > tglx >