Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1626887

[PATCH 2/3] x86/intel_rdt: Trim whitespace while parsing schemata input

From Vikas Shivappa <vikas.shivappa@linux.intel.com>
Newsgroups linux.kernel
Subject [PATCH 2/3] x86/intel_rdt: Trim whitespace while parsing schemata input
Date 2017-04-20 02:00 +0200
Message-ID <ty7FT-1nw-1@gated-at.bofh.it> (permalink)
References <ty7wd-1ki-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 <sai.praneeth.prakhya@intel.com>
Signed-off-by: Vikas Shivappa <vikas.shivappa@linux.intel.com>
Tested-by: Prakhya, Sai Praneeth <sai.praneeth.prakhya@intel.com>
---
 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) &&
 			    closid < r->num_closid) {
 				ret = parse_line(tok, r);
 				if (ret)
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] x86/intel_rdt: Fixes for schemata parsing issues Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2017-04-20 01:50 +0200
  [PATCH 3/3] x86/intel_rdt: Return error for incorrect resource names in schemata Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2017-04-20 01:50 +0200
    Re: [PATCH 3/3] x86/intel_rdt: Return error for incorrect resource  names in schemata Thomas Gleixner <tglx@linutronix.de> - 2017-04-20 15:50 +0200
      Re: [PATCH 3/3] x86/intel_rdt: Return error for incorrect resource  names in schemata Shivappa Vikas <vikas.shivappa@intel.com> - 2017-04-20 21:00 +0200
    [tip:x86/cpu] x86/intel_rdt: Return error for incorrect resource  names in schemata tip-bot for Vikas Shivappa <tipbot@zytor.com> - 2017-04-20 16:10 +0200
  [PATCH 2/3] x86/intel_rdt: Trim whitespace while parsing schemata input Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2017-04-20 02:00 +0200
    Re: [PATCH 2/3] x86/intel_rdt: Trim whitespace while parsing schemata  input Thomas Gleixner <tglx@linutronix.de> - 2017-04-20 16:00 +0200
      Re: [PATCH 2/3] x86/intel_rdt: Trim whitespace while parsing schemata  input Thomas Gleixner <tglx@linutronix.de> - 2017-04-20 20:00 +0200
        Re: [PATCH 2/3] x86/intel_rdt: Trim whitespace while parsing schemata  input Shivappa Vikas <vikas.shivappa@intel.com> - 2017-04-20 23:20 +0200
      Re: [PATCH 2/3] x86/intel_rdt: Trim whitespace while parsing schemata  input Shivappa Vikas <vikas.shivappa@intel.com> - 2017-04-20 20:00 +0200
    [tip:x86/cpu] x86/intel_rdt: Trim whitespace while parsing schemata  input tip-bot for Vikas Shivappa <tipbot@zytor.com> - 2017-04-20 16:10 +0200
  [PATCH 1/3] x86/intel_rdt: Fix padding when resource is enabled via mount Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2017-04-20 02:00 +0200
    [tip:x86/cpu] x86/intel_rdt: Fix padding when resource is enabled  via mount tip-bot for Vikas Shivappa <tipbot@zytor.com> - 2017-04-20 16:10 +0200

csiph-web