diff options
author | Alexander Shishkin <alexander.shishkin@linux.intel.com> | 2016-03-04 09:16:31 -0500 |
---|---|---|
committer | Alexander Shishkin <alexander.shishkin@linux.intel.com> | 2016-04-08 09:11:55 -0400 |
commit | 6575cbd67172bbcbfbb50ddd854d2b90c9f4e358 (patch) | |
tree | afb171b15a3e11db7aaa847384753fe0a4c22741 /drivers/hwtracing/intel_th | |
parent | 8f1127ea09a7bfe7e1b5fab5b7f52bd56f2d1bf5 (diff) |
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@intel.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Reviewed-by: Laurent Fert <laurent.fert@intel.com>
Diffstat (limited to 'drivers/hwtracing/intel_th')
-rw-r--r-- | drivers/hwtracing/intel_th/msu.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c index d9d6022c5aca..747ccf84bd93 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, | |||
1393 | do { | 1393 | do { |
1394 | end = memchr(p, ',', len); | 1394 | end = memchr(p, ',', len); |
1395 | s = kstrndup(p, end ? end - p : len, GFP_KERNEL); | 1395 | s = kstrndup(p, end ? end - p : len, GFP_KERNEL); |
1396 | if (!s) { | ||
1397 | ret = -ENOMEM; | ||
1398 | goto free_win; | ||
1399 | } | ||
1400 | |||
1396 | ret = kstrtoul(s, 10, &val); | 1401 | ret = kstrtoul(s, 10, &val); |
1397 | kfree(s); | 1402 | kfree(s); |
1398 | 1403 | ||