1
Fork 0
mirror of https://https.git.savannah.gnu.org/git/guix.git/ synced 2025-07-14 19:10:49 +02:00
guix/gnu/packages/patches/efivar-fix-fprint-format.patch
Efraim Flashner a8287d8bc4
gnu: efivar: Fix build on other architectures.
* gnu/packages/linux.scm (efivar)[source]: Add patch.
* gnu/packages/patches/efivar-fix-fprint-format.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.

Change-Id: I6b80ef642e953bbf68b9dd972a176a2bb155104f
2025-06-16 12:04:56 +03:00

46 lines
2.3 KiB
Diff

iter->offset is type off_t, so signed int, and is always safe to cast to unsigned long.
This fixes builds on i686 and armhf, and cross-compiling from x86_64 to riscv64.
The issue can be traced at https://github.com/rhboot/efivar/issues/270
And this commit is at https://github.com/rhboot/efivar/pull/281
diff --git a/src/esl-iter.c b/src/esl-iter.c
index 4a1938a..e4c8fb8 100644
--- a/src/esl-iter.c
+++ b/src/esl-iter.c
@@ -337,7 +337,7 @@ esl_list_iter_next_with_size_correction(esl_list_iter *iter, efi_guid_t *type,
if (correct_size && (iter->len - iter->offset) > 0) {
warnx("correcting ESL size from %d to %jd at %lx",
iter->esl->signature_list_size,
- (intmax_t)(iter->len - iter->offset), iter->offset);
+ (intmax_t)(iter->len - iter->offset), (unsigned long)iter->offset);
debug("correcting ESL size from %d to %zd at %lx",
iter->esl->signature_list_size,
iter->len - iter->offset, iter->offset);
@@ -362,7 +362,7 @@ esl_list_iter_next_with_size_correction(esl_list_iter *iter, efi_guid_t *type,
if (correct_size && (iter->len - iter->offset) > 0) {
warnx("correcting ESL size from %d to %jd at 0x%lx",
iter->esl->signature_list_size,
- (intmax_t)(iter->len - iter->offset), iter->offset);
+ (intmax_t)(iter->len - iter->offset), (unsigned long)iter->offset);
debug("correcting ESL size from %d to %zd at 0x%lx",
iter->esl->signature_list_size,
iter->len - iter->offset, iter->offset);
@@ -394,7 +394,7 @@ esl_list_iter_next_with_size_correction(esl_list_iter *iter, efi_guid_t *type,
if ((uint32_t)iter->offset >= iter->len)
return 0;
iter->esl = (efi_signature_list_t *)((intptr_t)iter->buf
- + iter->offset);
+ + (unsigned long)iter->offset);
}
efi_signature_list_t esl;
@@ -413,7 +413,7 @@ esl_list_iter_next_with_size_correction(esl_list_iter *iter, efi_guid_t *type,
if (correct_size && (iter->len - iter->offset) > 0) {
warnx("correcting ESL size from %d to %jd at 0x%lx",
iter->esl->signature_list_size,
- (intmax_t)(iter->len - iter->offset), iter->offset);
+ (intmax_t)(iter->len - iter->offset), (unsigned long)iter->offset);
debug("correcting ESL size from %d to %zd at 0x%lx",
iter->esl->signature_list_size,
iter->len - iter->offset, iter->offset);