[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1461149012-26954-11-git-send-email-alexander.shishkin@linux.intel.com>
Date: Wed, 20 Apr 2016 13:43:23 +0300
From: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
To: Greg KH <greg@...ah.com>
Cc: Mathieu Poirier <mathieu.poirier@...aro.org>,
Chunyan Zhang <zhang.chunyan@...aro.org>,
laurent.fert@...el.com, yann.fouassier@...el.com,
linux-kernel@...r.kernel.org,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Subject: [QUEUED v20160420 10/19] intel_th: msu: Handle kstrndup() failure
Currently, the nr_pages attribute store does not check if kstrndup()
succeeded. Fix this.
Reported-by: Alan Cox <alan.cox@...el.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Reviewed-by: Laurent Fert <laurent.fert@...el.com>
---
drivers/hwtracing/intel_th/msu.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c
index d9d6022c5a..747ccf84bd 100644
--- a/drivers/hwtracing/intel_th/msu.c
+++ b/drivers/hwtracing/intel_th/msu.c
@@ -1393,6 +1393,11 @@ nr_pages_store(struct device *dev, struct device_attribute *attr,
do {
end = memchr(p, ',', len);
s = kstrndup(p, end ? end - p : len, GFP_KERNEL);
+ if (!s) {
+ ret = -ENOMEM;
+ goto free_win;
+ }
+
ret = kstrtoul(s, 10, &val);
kfree(s);
--
2.8.0.rc3
Powered by blists - more mailing lists