summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/efivar-fix-fprint-format.patch
blob: 41f78b696c1a6e1724c65201b9d87cd30b540fb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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);