浏览代码

[ACPI] check for kmalloc failure in toshiba_acpi.c

Signed-off-by: Panagiotis Issaris <takis@gna.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Len Brown <len.brown@intel.com>
Panagiotis Issaris 20 年之前
父节点
当前提交
f422415309
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      drivers/acpi/toshiba_acpi.c

+ 3 - 0
drivers/acpi/toshiba_acpi.c

@@ -263,6 +263,9 @@ dispatch_write(struct file* file, const char __user * buffer,
 	 * destination so that sscanf can be used on it safely.
 	 */
 	tmp_buffer = kmalloc(count + 1, GFP_KERNEL);
+	if(!tmp_buffer)
+		return -ENOMEM;
+
 	if (copy_from_user(tmp_buffer, buffer, count)) {
 		result = -EFAULT;
 	}