Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

intel_th: msu: Handle kstrndup() failure

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

Reported-by: Alan Cox <alan.cox@intel.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Reviewed-by: Laurent Fert <laurent.fert@intel.com>

+5
+5
drivers/hwtracing/intel_th/msu.c
··· 1393 1393 do { 1394 1394 end = memchr(p, ',', len); 1395 1395 s = kstrndup(p, end ? end - p : len, GFP_KERNEL); 1396 + if (!s) { 1397 + ret = -ENOMEM; 1398 + goto free_win; 1399 + } 1400 + 1396 1401 ret = kstrtoul(s, 10, &val); 1397 1402 kfree(s); 1398 1403