提交 2572c7fb 编写于 作者: S Sudip Mukherjee 提交者: Jon Mason

ntb: fix possible NULL dereference

kmalloc can fail and we should check for NULL before using the pointer
returned by kmalloc.
Signed-off-by: NSudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Acked-by: NDave Jiang <dave.jiang@intel.com>
Signed-off-by: NJon Mason <jdmason@kudzu.us>
上级 ee5f750f
......@@ -550,6 +550,8 @@ static ssize_t debugfs_run_read(struct file *filp, char __user *ubuf,
return 0;
buf = kmalloc(64, GFP_KERNEL);
if (!buf)
return -ENOMEM;
out_offset = snprintf(buf, 64, "%d\n", perf->run);
ret = simple_read_from_buffer(ubuf, count, offp, buf, out_offset);
kfree(buf);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册