]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
boot/efi: use Header field of hd directly instead of casting to EFI_DEVICE_PATH
authorRose <83477269+AtariDreams@users.noreply.github.com>
Sun, 7 Jan 2024 19:43:43 +0000 (14:43 -0500)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 11 Jan 2024 05:03:13 +0000 (14:03 +0900)
The header of EFI_DEVICE_PATH is the first member of hd, which means that we can use that directly instead of casting one struct to another.

src/boot/efi/part-discovery.c

index f5b157305594c6d21d773a52ff95dab5feb1fa48..e66e2daf3043c59c777f75cff27b4c3d28438d59 100644 (file)
@@ -232,7 +232,7 @@ static EFI_STATUS find_device(const EFI_GUID *type, EFI_HANDLE *device, EFI_DEVI
                 }
 
                 /* Patch in the data we found */
-                *ret_device_path = device_path_replace_node(partition_path, part_node, (EFI_DEVICE_PATH *) &hd);
+                *ret_device_path = device_path_replace_node(partition_path, part_node, &hd.Header);
                 return EFI_SUCCESS;
         }