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

Commit 0c89843a authored by Jordan Crouse's avatar Jordan Crouse
Browse files

msm: kgsl: Avoid a possible pointer deference in __force_on_show



Make sure the device pointer is a thing before using it in
__force_on_show().

Change-Id: Ic0dedbad2e47f3bfb22daf43a910ab886200c03c
Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
parent ef5115f7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -648,10 +648,10 @@ static ssize_t __force_on_show(struct device *dev,
					char *buf, int flag)
{
	struct kgsl_device *device = kgsl_device_from_dev(dev);
	int i = test_bit(flag, &device->pwrctrl.ctrl_flags);
	if (device == NULL)
		return 0;
	return snprintf(buf, PAGE_SIZE, "%d\n", i);
	return snprintf(buf, PAGE_SIZE, "%d\n",
		test_bit(flag, &device->pwrctrl.ctrl_flags));
}

static ssize_t __force_on_store(struct device *dev,