summaryrefslogtreecommitdiffstats
path: root/drivers/firmware
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 11:14:44 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 11:14:44 -0700
commit04bbc8e1f68cf4c1aac8024d6aea1a24757e8a5a (patch)
tree9eee2dd7cca805dc27490a624160ef6d9ddd7dd1 /drivers/firmware
parente39dfe52f8f67061317e7108f62a2b33a3d06580 (diff)
parent0d838347f1325cebfe8b9341a4b4c1f407022231 (diff)
Merge tag 'please-pull-pstore' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux
Pull pstore update from Tony Luck: "Fixes for pstore for 3.11 merge window" * tag 'please-pull-pstore' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux: efivars: If pstore_register fails, free unneeded pstore buffer acpi: Eliminate console msg if pstore.backend excludes ERST pstore: Return unique error if backend registration excluded by kernel param pstore: Fail to unlink if a driver has not defined pstore_erase pstore/ram: remove the power of buffer size limitation pstore/ram: avoid atomic accesses for ioremapped regions efi, pstore: Cocci spatch "memdup.spatch"
Diffstat (limited to 'drivers/firmware')
-rw-r--r--drivers/firmware/efi/efi-pstore.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c
index 202d2c85ba2..91864ad200f 100644
--- a/drivers/firmware/efi/efi-pstore.c
+++ b/drivers/firmware/efi/efi-pstore.c
@@ -79,10 +79,9 @@ static int efi_pstore_read_func(struct efivar_entry *entry, void *data)
&entry->var.DataSize, entry->var.Data);
size = entry->var.DataSize;
- *cb_data->buf = kmalloc(size, GFP_KERNEL);
+ *cb_data->buf = kmemdup(entry->var.Data, size, GFP_KERNEL);
if (*cb_data->buf == NULL)
return -ENOMEM;
- memcpy(*cb_data->buf, entry->var.Data, size);
return size;
}
@@ -236,7 +235,11 @@ static __init int efivars_pstore_init(void)
efi_pstore_info.bufsize = 1024;
spin_lock_init(&efi_pstore_info.buf_lock);
- pstore_register(&efi_pstore_info);
+ if (pstore_register(&efi_pstore_info)) {
+ kfree(efi_pstore_info.buf);
+ efi_pstore_info.buf = NULL;
+ efi_pstore_info.bufsize = 0;
+ }
return 0;
}