aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware/efivars.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firmware/efivars.c')
-rw-r--r--drivers/firmware/efivars.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index 33b17c6a46fb..bda5bce681b6 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -614,16 +614,14 @@ efivar_create_sysfs_entry(unsigned long variable_name_size,
614 char *short_name; 614 char *short_name;
615 struct efivar_entry *new_efivar; 615 struct efivar_entry *new_efivar;
616 616
617 short_name = kmalloc(short_name_size + 1, GFP_KERNEL); 617 short_name = kzalloc(short_name_size + 1, GFP_KERNEL);
618 new_efivar = kmalloc(sizeof(struct efivar_entry), GFP_KERNEL); 618 new_efivar = kzalloc(sizeof(struct efivar_entry), GFP_KERNEL);
619 619
620 if (!short_name || !new_efivar) { 620 if (!short_name || !new_efivar) {
621 kfree(short_name); 621 kfree(short_name);
622 kfree(new_efivar); 622 kfree(new_efivar);
623 return 1; 623 return 1;
624 } 624 }
625 memset(short_name, 0, short_name_size+1);
626 memset(new_efivar, 0, sizeof(struct efivar_entry));
627 625
628 memcpy(new_efivar->var.VariableName, variable_name, 626 memcpy(new_efivar->var.VariableName, variable_name,
629 variable_name_size); 627 variable_name_size);
@@ -674,14 +672,12 @@ efivars_init(void)
674 if (!efi_enabled) 672 if (!efi_enabled)
675 return -ENODEV; 673 return -ENODEV;
676 674
677 variable_name = kmalloc(variable_name_size, GFP_KERNEL); 675 variable_name = kzalloc(variable_name_size, GFP_KERNEL);
678 if (!variable_name) { 676 if (!variable_name) {
679 printk(KERN_ERR "efivars: Memory allocation failed.\n"); 677 printk(KERN_ERR "efivars: Memory allocation failed.\n");
680 return -ENOMEM; 678 return -ENOMEM;
681 } 679 }
682 680
683 memset(variable_name, 0, variable_name_size);
684
685 printk(KERN_INFO "EFI Variables Facility v%s %s\n", EFIVARS_VERSION, 681 printk(KERN_INFO "EFI Variables Facility v%s %s\n", EFIVARS_VERSION,
686 EFIVARS_DATE); 682 EFIVARS_DATE);
687 683