提交 6575cbd6 编写于 作者: A Alexander Shishkin

intel_th: msu: Handle kstrndup() failure

Currently, the nr_pages attribute store does not check if kstrndup()
succeeded. Fix this.
Reported-by: NAlan Cox <alan.cox@intel.com>
Signed-off-by: NAlexander Shishkin <alexander.shishkin@linux.intel.com>
Reviewed-by: NLaurent Fert <laurent.fert@intel.com>
上级 8f1127ea
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册