mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-05 16:37:50 +00:00
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>
This commit is contained in:
parent
8f1127ea09
commit
6575cbd671
1 changed files with 5 additions and 0 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue