thinkpad_acpi: fix possible NULL pointer dereference if kstrdup failed

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
Cyrill Gorcunov 2008-04-18 13:27:29 -07:00 committed by Len Brown
parent a815ab8b58
commit 90fe17f4df
1 changed files with 1 additions and 1 deletions

View File

@ -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;
}