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

Commit 6575cbd6 authored by Alexander Shishkin's avatar Alexander Shishkin
Browse files

intel_th: msu: Handle kstrndup() failure



Currently, the nr_pages attribute store does not check if kstrndup()
succeeded. Fix this.

Reported-by: default avatarAlan Cox <alan.cox@intel.com>
Signed-off-by: default avatarAlexander Shishkin <alexander.shishkin@linux.intel.com>
Reviewed-by: default avatarLaurent Fert <laurent.fert@intel.com>
parent 8f1127ea
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -1393,6 +1393,11 @@ nr_pages_store(struct device *dev, struct device_attribute *attr,
	do {
	do {
		end = memchr(p, ',', len);
		end = memchr(p, ',', len);
		s = kstrndup(p, end ? end - p : len, GFP_KERNEL);
		s = kstrndup(p, end ? end - p : len, GFP_KERNEL);
		if (!s) {
			ret = -ENOMEM;
			goto free_win;
		}

		ret = kstrtoul(s, 10, &val);
		ret = kstrtoul(s, 10, &val);
		kfree(s);
		kfree(s);