summaryrefslogtreecommitdiff
path: root/drivers/platform/x86/dell-laptop.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-10 20:09:47 +0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-10 20:09:47 +0400
commitf741df1f3a2afe988f413ca78d1e866657079beb (patch)
tree385fe773b3549dec86261cf1933beb3f8a7adf61 /drivers/platform/x86/dell-laptop.c
parentc67723ebbb2d6f672a0e9e5b1a8d1a2442942557 (diff)
parent5950f0803ca9d396ab79b7fe6789351f96e1d8d5 (diff)
downloadlinux-f741df1f3a2afe988f413ca78d1e866657079beb.tar.xz
Merge tag 'for-linus-20130509' of git://git.infradead.org/~dwmw2/random-2.6
Pull misc fixes from David Woodhouse: "This is some miscellaneous cleanups that don't really belong anywhere else (or were ignored), that have been sitting in linux-next for some time. Two of them are fixes resulting from my audit of krealloc() usage that don't seem to have elicited any response when I posted them, and the other three are patches from Artem removing dead code." * tag 'for-linus-20130509' of git://git.infradead.org/~dwmw2/random-2.6: pcmcia: remove RPX board stuff m68k: remove rpxlite stuff pcmcia: remove Motorola MBX860 support params: Fix potential memory leak in add_sysfs_param() dell-laptop: Fix krealloc() misuse in parse_da_table()
Diffstat (limited to 'drivers/platform/x86/dell-laptop.c')
-rw-r--r--drivers/platform/x86/dell-laptop.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index fa3ee6209572..1134119521ac 100644
--- a/drivers/platform/x86/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -284,6 +284,7 @@ static void __init parse_da_table(const struct dmi_header *dm)
{
/* Final token is a terminator, so we don't want to copy it */
int tokens = (dm->length-11)/sizeof(struct calling_interface_token)-1;
+ struct calling_interface_token *new_da_tokens;
struct calling_interface_structure *table =
container_of(dm, struct calling_interface_structure, header);
@@ -296,12 +297,13 @@ static void __init parse_da_table(const struct dmi_header *dm)
da_command_address = table->cmdIOAddress;
da_command_code = table->cmdIOCode;
- da_tokens = krealloc(da_tokens, (da_num_tokens + tokens) *
- sizeof(struct calling_interface_token),
- GFP_KERNEL);
+ new_da_tokens = krealloc(da_tokens, (da_num_tokens + tokens) *
+ sizeof(struct calling_interface_token),
+ GFP_KERNEL);
- if (!da_tokens)
+ if (!new_da_tokens)
return;
+ da_tokens = new_da_tokens;
memcpy(da_tokens+da_num_tokens, table->tokens,
sizeof(struct calling_interface_token) * tokens);