Skip to contentSkip to conversation

ThinkPad ACPI: fix possible NULL pointer dereference

PATCH Applied [email protected] 2 participants 2 messages Apr 18, 2008 – Apr 29, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 9/9 ThinkPad ACPI: fix possible NULL pointer dereference

From: Cyrill Gorcunov <[email protected]>

Fix potential NULL pointer dereference if kstrdup failed

---

 drivers/misc/thinkpad_acpi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/thinkpad_acpi.c renamed from drivers/misc/thinkpad_acpi.c~thinkpad-acpi-fix-possible-null-pointer-dereference +1 -1
diff -puN drivers/misc/thinkpad_acpi.c~thinkpad-acpi-fix-possible-null-pointer-dereference drivers/misc/thinkpad_acpi.c
@@ -5826,7 +5826,7 @@ static void __init get_thinkpad_model_da
 
 	tp->model_str = kstrdup(dmi_get_system_info(DMI_PRODUCT_VERSION),
 					GFP_KERNEL);
-	if (strnicmp(tp->model_str, "ThinkPad", 8) != 0) {
+	if (tp->model_str && strnicmp(tp->model_str, "ThinkPad", 8) != 0) {
 		kfree(tp->model_str);
 		tp->model_str = NULL;
 	}

_

reviewer Applied
#1 lore raw

applied

thanks,
-len

Quoted 30 lines · On Friday 18 April 2008, [email protected] wrote:

From: Cyrill Gorcunov <[email protected]>

Fix potential NULL pointer dereference if kstrdup failed

---

 drivers/misc/thinkpad_acpi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/misc/thinkpad_acpi.c~thinkpad-acpi-fix-possible-null-pointer-dereference drivers/misc/thinkpad_acpi.c

drivers/misc/thinkpad_acpi.c renamed from drivers/misc/thinkpad_acpi.c~thinkpad-acpi-fix-possible-null-pointer-dereference +1 -1
@@ -5826,7 +5826,7 @@ static void __init get_thinkpad_model_da
 
 	tp->model_str = kstrdup(dmi_get_system_info(DMI_PRODUCT_VERSION),
 					GFP_KERNEL);
-	if (strnicmp(tp->model_str, "ThinkPad", 8) != 0) {
+	if (tp->model_str && strnicmp(tp->model_str, "ThinkPad", 8) != 0) {
 		kfree(tp->model_str);
 		tp->model_str = NULL;
 	}

_
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html