Skip to content

Commit

Permalink
thinkpad_acpi: fix possible NULL pointer dereference if kstrdup failed
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Cyrill Gorcunov authored and Len Brown committed Apr 29, 2008
1 parent a815ab8 commit 90fe17f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/misc/thinkpad_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 90fe17f

Please sign in to comment.