2005-03-05 00:36:59

by Panagiotis Issaris

[permalink] [raw]
Subject: [PATCH] Toshiba ACPI failure handling

Hi,

Adds the missing failure handling for a kmalloc in the Toshiba
ACPI driver.

Signed-off-by: Panagiotis Issaris <[email protected]>

diff -pruN linux-2.6.11-orig/drivers/acpi/toshiba_acpi.c linux-2.6.11-pi/drivers/acpi/toshiba_acpi.c
--- linux-2.6.11-orig/drivers/acpi/toshiba_acpi.c 2005-03-05 01:04:40.000000000 +0100
+++ linux-2.6.11-pi/drivers/acpi/toshiba_acpi.c 2005-03-05 01:03:13.000000000 +0100
@@ -263,6 +263,9 @@ dispatch_write(struct file* file, const
* 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;
}

--
K.U.Leuven, Mechanical Eng., Mechatronics & Robotics Research Group
http://people.mech.kuleuven.ac.be/~pissaris/