Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2572c7fb authored by Sudip Mukherjee's avatar Sudip Mukherjee Committed by Jon Mason
Browse files

ntb: fix possible NULL dereference



kmalloc can fail and we should check for NULL before using the pointer
returned by kmalloc.

Signed-off-by: default avatarSudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Acked-by: default avatarDave Jiang <dave.jiang@intel.com>
Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
parent ee5f750f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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);