From 4b4d24060ef5ae99c5dca12f39433edc7ccfd741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Stehl=C3=A9?= Date: Mon, 24 Mar 2025 09:34:43 +0100 Subject: [PATCH] efi_loader: fix ipv4 device path node conversion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When converting an IPv4 device path node to text, the EFI_DEVICE_PATH_TO_TEXT_PROTOCOL will produce the following string: IPv4(5.6.7.8,TCP,UDP,0x6,DHCP,1.2.3.4,9.10.11.12,255.255.255.0) This string erroneously contains multiple protocols: TCP, UDP and 0x6. Add the missing `break' statements in the dp_msging() function to fix this and obtain the following expected string instead: IPv4(5.6.7.8,TCP,DHCP,1.2.3.4,9.10.11.12,255.255.255.0) Fixes: aaf63429a112 ("efi_loader: add IPv4() to device path to text protocol") Signed-off-by: Vincent Stehlé Cc: Heinrich Schuchardt Cc: Ilias Apalodimas Cc: Adriano Cordova Cc: Tom Rini Reviewed-by: Ilias Apalodimas Reviewed-by: Heinrich Schuchardt Reviewed-by: Andre Przywara Signed-off-by: Ilias Apalodimas --- lib/efi_loader/efi_device_path_to_text.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/efi_loader/efi_device_path_to_text.c b/lib/efi_loader/efi_device_path_to_text.c index f6889cb7399..452ec1b2e8b 100644 --- a/lib/efi_loader/efi_device_path_to_text.c +++ b/lib/efi_loader/efi_device_path_to_text.c @@ -181,10 +181,13 @@ static char *dp_msging(char *s, struct efi_device_path *dp) switch (idp->protocol) { case IPPROTO_TCP: s += sprintf(s, "TCP,"); + break; case IPPROTO_UDP: s += sprintf(s, "UDP,"); + break; default: s += sprintf(s, "0x%x,", idp->protocol); + break; } s += sprintf(s, idp->static_ip_address ? "Static" : "DHCP"); s += sprintf(s, ",%pI4", &idp->local_ip_address);