Skip to contentSkip to conversation

efi_loader: add missing breaks

PATCH Applied Rob Clark 3 participants 4 messages Nov 30, 2017 – Dec 4, 2017

lore
Share & tools
lore

Rob Clark

author
#0 lore raw

PATCH 1/1 efi_loader: add missing breaks

Otherwise with GUID partition types you would end up with things like:

.../HD(Part0,Sig6252c819-4624-4995-8d16-abc9cd5d4130)/HD(Part0,MBRType=02,SigType=02)

---
Reported by 'ykaukab' on IRC.

Not sure if someone already sent a similar patch.

 lib/efi_loader/efi_device_path_to_text.c | 2 ++
 1 file changed, 2 insertions(+)
lib/efi_loader/efi_device_path_to_text.c +2 -0
index 62771338f0..3b703301ff 100644
@@ -135,10 +135,12 @@ static char *dp_media(char *s, struct efi_device_path *dp)
 		case SIG_TYPE_GUID:
 			s += sprintf(s, "/HD(Part%d,Sig%pUl)",
 				     hddp->partition_number, sig);
+			break;
 		default:
 			s += sprintf(s, "/HD(Part%d,MBRType=%02x,SigType=%02x)",
 				     hddp->partition_number, hddp->partmap_type,
 				     hddp->signature_type);
+			break;
 		}
 
 		break;
Signature · 1 line
2.13.6
#1 lore raw

PATCH 1/1 efi_loader: add missing breaks

Quoted 18 lines · Rob Clark

Otherwise with GUID partition types you would end up with things like:

   .../HD(Part0,Sig6252c819-4624-4995-8d16-abc9cd5d4130)/HD(Part0,MBRType=02,SigType=02)

---
Reported by 'ykaukab' on IRC.

Not sure if someone already sent a similar patch.

  lib/efi_loader/efi_device_path_to_text.c | 2 ++
  1 file changed, 2 insertions(+)
lib/efi_loader/efi_device_path_to_text.c +0 -0
index 62771338f0..3b703301ff 100644

lib/efi_loader/efi_device_path_to_text.c static char *dp_media(char *s, struct efi_device_path *dp) · line 136

Quoted 2 lines
lib/efi_loader/efi_device_path_to_text.c +0 -0
@@ -135,10 +135,12 @@ static char *dp_media(char *s, struct efi_device_path *dp)
  		case SIG_TYPE_GUID:
  			s += sprintf(s, "/HD(Part%d,Sig%pUl)",

This is not the format defined in UEFI Spec 2.7:

HD(Partition, Type, Signature, Start, Size)
HD(Partition, Type, Signature) (Display only)

We should output something like:
/HD(1,MBR,0xA0021243,0x800,0x2EE00)

lib/efi_loader/efi_device_path_to_text.c static char *dp_media(char *s, struct efi_device_path *dp) · line 142

Quoted 6 lines
lib/efi_loader/efi_device_path_to_text.c +1 -0
  				     hddp->partition_number, sig);
+			break;
  		default:
  			s += sprintf(s, "/HD(Part%d,MBRType=%02x,SigType=%02x)",
  				     hddp->partition_number, hddp->partmap_type,
  				     hddp->signature_type);

See above.

lib/efi_loader/efi_device_path_to_text.c static char *dp_media(char *s, struct efi_device_path *dp) · line 143

Quoted 1 line
lib/efi_loader/efi_device_path_to_text.c +1 -0
+			break;

This line is superfluous at the end of a switch block.

Could you, please, rebase your patch on
[PATCH v3 04/18] efi_loader: fix efi_convert_device_node_to_text
https://lists.denx.de/pipermail/u-boot/2017-November/312523.html

Best regards

Heinrich

Quoted 4 lines
lib/efi_loader/efi_device_path_to_text.c +0 -0
  		}
 
  		break;
#2 lore raw

PATCH 1/1 efi_loader: add missing breaks

Quoted 43 lines · Heinrich Schuchardt
Quoted 22 lines · Rob Clark

Otherwise with GUID partition types you would end up with things like:

.../HD(Part0,Sig6252c819-4624-4995-8d16-abc9cd5d4130)/HD(Part0,MBRType=02,SigType=02)

---
Reported by 'ykaukab' on IRC.

Not sure if someone already sent a similar patch.

  lib/efi_loader/efi_device_path_to_text.c | 2 ++

  1 file changed, 2 insertions(+)
lib/efi_loader/efi_device_path_to_text.c +0 -0
index 62771338f0..3b703301ff 100644
@@ -135,10 +135,12 @@ static char *dp_media(char *s, struct
 efi_device_path *dp)
Quoted 2 lines

          case SIG_TYPE_GUID:
              s += sprintf(s, "/HD(Part%d,Sig%pUl)",

This is not the format defined in UEFI Spec 2.7:

HD(Partition, Type, Signature, Start, Size)
HD(Partition, Type, Signature) (Display only)

We should output something like:
/HD(1,MBR,0xA0021243,0x800,0x2EE00)

Quoted 6 lines

                       hddp->partition_number, sig);
+            break;
          default:
              s += sprintf(s, "/HD(Part%d,MBRType=%02x,SigType=%02x)", hddp->partition_number, hddp->partmap_type, hddp->signature_type);

Quoted 5 lines

See above.

Quoted 1 line

+            break;

This line is superfluous at the end of a switch block.

I actually like the symmetry of a break at the end of default (or whatever the last switch case is).

Quoted 4 lines

Could you, please, rebase your patch on
[PATCH v3 04/18] efi_loader: fix efi_convert_device_node_to_text
https://lists.denx.de/pipermail/u-boot/2017-November/312523.html

I've just manually fixed it up and applied it now.

Alex