From: Cyrill Gorcunov Date: Fri, 18 Apr 2008 20:27:29 +0000 (-0700) Subject: thinkpad_acpi: fix possible NULL pointer dereference if kstrdup failed X-Git-Tag: v2.6.26-rc1~101^2~1^8~3 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90fe17f4df2f830601ffd422b11d1f7f9a9d0355;p=linux-2.6 thinkpad_acpi: fix possible NULL pointer dereference if kstrdup failed Signed-off-by: Cyrill Gorcunov Acked-by: Henrique de Moraes Holschuh Signed-off-by: Andrew Morton Signed-off-by: Len Brown --- diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index 6cb781262f..31115c9cfb 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c @@ -5826,7 +5826,7 @@ static void __init get_thinkpad_model_data(struct thinkpad_id_data *tp) 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; }