]> git.sur5r.net Git - u-boot/blobdiff - lib/efi_loader/efi_device_path.c
efi_loader: initialise partition_signature memory
[u-boot] / lib / efi_loader / efi_device_path.c
index 024877161bd78408febc31a72a3b843e73ea1339..9027ae8efb7b8eae89f3bbe1d88ca1bac19165ac 100644 (file)
@@ -428,10 +428,27 @@ static void *dp_part_fill(void *buf, struct blk_desc *desc, int part)
                        hddp->partmap_type = 2;
                else
                        hddp->partmap_type = 1;
-               hddp->signature_type = desc->sig_type;
-               if (hddp->signature_type != 0)
+
+               switch (desc->sig_type) {
+               case SIG_TYPE_NONE:
+               default:
+                       hddp->signature_type = 0;
+                       memset(hddp->partition_signature, 0,
+                              sizeof(hddp->partition_signature));
+                       break;
+               case SIG_TYPE_MBR:
+                       hddp->signature_type = 1;
+                       memset(hddp->partition_signature, 0,
+                              sizeof(hddp->partition_signature));
+                       memcpy(hddp->partition_signature, &desc->mbr_sig,
+                              sizeof(desc->mbr_sig));
+                       break;
+               case SIG_TYPE_GUID:
+                       hddp->signature_type = 2;
                        memcpy(hddp->partition_signature, &desc->guid_sig,
                               sizeof(hddp->partition_signature));
+                       break;
+               }
 
                buf = &hddp[1];
        }