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

Commit 5767de70 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: qpnp-qg: Fix kernel memory corruption error in qg_device_read"

parents 7a292d37 0d3d43d9
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2578,6 +2578,12 @@ static ssize_t qg_device_read(struct file *file, char __user *buf, size_t count,
	struct qpnp_qg *chip = file->private_data;
	unsigned long data_size = sizeof(chip->kdata);

	if (count < data_size) {
		pr_err("Invalid datasize %lu, expected lesser then %zu\n",
							data_size, count);
		return -EINVAL;
	}

	/* non-blocking access, return */
	if (!chip->data_ready && (file->f_flags & O_NONBLOCK))
		return 0;