Skip to contentSkip to conversation

efi_loader: pass GUID by address

PATCH In review Vincent Stehlé 3 participants 3 messages Sep 7 – Sep 8

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efi_loader: pass GUID by address

Instead of passing a GUID by value to the hash_algo_supported() function, prefer passing a pointer.

Cc Heinrich Schuchardt <[email protected]>
Cc Ilias Apalodimas <[email protected]>
Cc Tom Rini <[email protected]>
---
 lib/efi_loader/efi_signature.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/efi_loader/efi_signature.c +3 -3
index c2be5cb61b3..21a96426356 100644
@@ -166,7 +166,7 @@ bool efi_hash_regions(struct image_region *regs, int count,
  *
  * Return: true if supported false otherwise
  */
-static bool hash_algo_supported(const efi_guid_t guid)
+static bool hash_algo_supported(const efi_guid_t *guid)
 {
 	int i;
 	const efi_guid_t unsupported_hashes[] = {
@@ -177,7 +177,7 @@ static bool hash_algo_supported(const efi_guid_t guid)
 	};
 
 	for (i = 0; i < ARRAY_SIZE(unsupported_hashes); i++) {
-		if (!guidcmp(&unsupported_hashes[i], &guid))
+		if (!guidcmp(&unsupported_hashes[i], guid))
 			return false;
 	}
 
@@ -219,7 +219,7 @@ bool efi_signature_lookup_digest(struct efi_image_regions *regs,
 		 * if the hash algorithm is unsupported and we get an entry in
 		 * dbx reject the image
 		 */
-		if (dbx && !hash_algo_supported(siglist->sig_type)) {
+		if (dbx && !hash_algo_supported(&siglist->sig_type)) {
 			found = true;
 			continue;
 		};

---
base-commit: 509312dc5386ff4c5adabf53a573abca0aac4ce5
change-id: 20260907-guidptr-9865d0f0dd1b

Best regards,

Signature · 1 line
Vincent.
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Vincent Stehlé

Instead of passing a GUID by value to the hash_algo_supported() function, prefer passing a pointer.

Cc Heinrich Schuchardt <[email protected]>
Cc Ilias Apalodimas <[email protected]>
Cc Tom Rini <[email protected]>

Yes, GUIDs should be passed via pointers.

Quoted 44 lines
---
  lib/efi_loader/efi_signature.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
lib/efi_loader/efi_signature.c +3 -4
index c2be5cb61b3..21a96426356 100644
@@ -166,7 +166,7 @@ bool efi_hash_regions(struct image_region *regs, int count,
   *
   * Return: true if supported false otherwise
   */
-static bool hash_algo_supported(const efi_guid_t guid)
+static bool hash_algo_supported(const efi_guid_t *guid)
  {
  	int i;
  	const efi_guid_t unsupported_hashes[] = {
@@ -177,7 +177,7 @@ static bool hash_algo_supported(const efi_guid_t guid)
  	};
 
  	for (i = 0; i < ARRAY_SIZE(unsupported_hashes); i++) {
-		if (!guidcmp(&unsupported_hashes[i], &guid))
+		if (!guidcmp(&unsupported_hashes[i], guid))
  			return false;
  	}
 
@@ -219,7 +219,7 @@ bool efi_signature_lookup_digest(struct efi_image_regions *regs,
  		 * if the hash algorithm is unsupported and we get an entry in
  		 * dbx reject the image
  		 */
-		if (dbx && !hash_algo_supported(siglist->sig_type)) {
+		if (dbx && !hash_algo_supported(&siglist->sig_type)) {
  			found = true;
  			continue;
  		};
 
---

base-commit: 509312dc5386ff4c5adabf53a573abca0aac4ce5
change-id: 20260907-guidptr-9865d0f0dd1b

Best regards,
--
Vincent.

Reviewed-by on v1 1/1
#2 lore raw
In reply to Vincent Stehlé
Quoted 9 lines · Vincent Stehlé

Instead of passing a GUID by value to the hash_algo_supported() function, prefer passing a pointer.

Cc Heinrich Schuchardt <[email protected]>
Cc Ilias Apalodimas <[email protected]>
Cc Tom Rini <[email protected]>

---

Quoted 48 lines
 lib/efi_loader/efi_signature.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/efi_loader/efi_signature.c +1 -1
index c2be5cb61b3..21a96426356 100644
@@ -166,7 +166,7 @@ bool efi_hash_regions(struct image_region *regs, int
 count,
  *
  * Return: true if supported false otherwise
  */
-static bool hash_algo_supported(const efi_guid_t guid)
+static bool hash_algo_supported(const efi_guid_t *guid)
 {
        int i;
        const efi_guid_t unsupported_hashes[] = {
lib/efi_loader/efi_signature.c +1 -1
@@ -177,7 +177,7 @@ static bool hash_algo_supported(const efi_guid_t guid)
        };
 
        for (i = 0; i < ARRAY_SIZE(unsupported_hashes); i++) {
-               if (!guidcmp(&unsupported_hashes[i], &guid))
+               if (!guidcmp(&unsupported_hashes[i], guid))
                        return false;
        }
 
@@ -219,7 +219,7 @@ bool efi_signature_lookup_digest(struct
 efi_image_regions *regs,
                 * if the hash algorithm is unsupported and we get an

entry in
* dbx reject the image
*/

lib/efi_loader/efi_signature.c +1 -2
-               if (dbx && !hash_algo_supported(siglist->sig_type)) {
+               if (dbx && !hash_algo_supported(&siglist->sig_type)) {
                        found = true;
                        continue;
                };
 
---

base-commit: 509312dc5386ff4c5adabf53a573abca0aac4ce5
change-id: 20260907-guidptr-9865d0f0dd1b

Best regards,
--
Vincent.