mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-04-12 18:26:39 +02:00
102 lines
3.4 KiB
Diff
102 lines
3.4 KiB
Diff
Fix -Wcalloc-transposed-args and -Wdiscarded-qualifiers errors with gcc 14.
|
|
|
|
(The -Wdiscarded-qualifiers warnings were treated as errors due to the project
|
|
source compiling with the -Werror flag.)
|
|
|
|
Example errors:
|
|
|
|
```
|
|
tools/ebgpart.c: In function 'read_GPT_entries':
|
|
tools/ebgpart.c:178:38: error: 'calloc' sizes specified with 'sizeof' in the
|
|
earlier argument and not in the later argument [-Werror=calloc-transposed-args]
|
|
178 | tmpp = calloc(sizeof(PedPartition), 1);
|
|
| ^~~~~~~~~~~~
|
|
tools/ebgpart.c:178:38: note: earlier argument should specify number of
|
|
elements, later size of each element
|
|
```
|
|
|
|
```
|
|
kernel-stub/fdt.c: In function 'clone_fdt':
|
|
kernel-stub/fdt.c:169:49: warning: passing argument 2 of 'CopyMem' discards
|
|
'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
|
|
169 | CopyMem((VOID *)(uintptr_t)*fdt_buffer, fdt,
|
|
| ^~~
|
|
In file included from kernel-stub/fdt.c:16:
|
|
/usr/include/efi/efilib.h:300:18: note: expected 'VOID *' {aka 'void *'} but
|
|
argument is of type 'const VOID *' {aka 'const void *'}
|
|
300 | IN VOID *Src,
|
|
| ~~~~~~~~~~^~~
|
|
```
|
|
|
|
--- efibootguard-0.16-origin/kernel-stub/fdt.c
|
|
+++ efibootguard-0.16/kernel-stub/fdt.c
|
|
@@ -166,7 +166,7 @@
|
|
error(L"Error allocating device tree buffer", status);
|
|
return status;
|
|
}
|
|
- CopyMem((VOID *)(uintptr_t)*fdt_buffer, fdt,
|
|
+ CopyMem((VOID *)(uintptr_t)*fdt_buffer, (char *)fdt,
|
|
BE32_TO_HOST(header->TotalSize));
|
|
return EFI_SUCCESS;
|
|
}
|
|
--- efibootguard-0.16-origin/kernel-stub/initrd.c
|
|
+++ efibootguard-0.16/kernel-stub/initrd.c
|
|
@@ -80,7 +80,7 @@
|
|
return EFI_BUFFER_TOO_SMALL;
|
|
}
|
|
|
|
- CopyMem(buffer, loader->addr, loader->size);
|
|
+ CopyMem(buffer, (VOID *)loader->addr, loader->size);
|
|
*buffer_size = loader->size;
|
|
|
|
return EFI_SUCCESS;
|
|
--- efibootguard-0.16-origin/kernel-stub/main.c
|
|
+++ efibootguard-0.16/kernel-stub/main.c
|
|
@@ -206,7 +206,8 @@
|
|
kernel_image.ImageBase = (VOID *) (uintptr_t) aligned_kernel_buffer;
|
|
kernel_image.ImageSize = kernel_section->VirtualSize;
|
|
|
|
- CopyMem(kernel_image.ImageBase, kernel_source, kernel_image.ImageSize);
|
|
+ CopyMem(kernel_image.ImageBase, (VOID *)kernel_source,
|
|
+ kernel_image.ImageSize);
|
|
/* Clear the rest so that .bss is definitely zero. */
|
|
SetMem((UINT8 *) kernel_image.ImageBase + kernel_image.ImageSize,
|
|
pe_header->Opt.SizeOfImage - kernel_image.ImageSize, 0);
|
|
--- efibootguard-0.16-origin/tools/ebgpart.c
|
|
+++ efibootguard-0.16/tools/ebgpart.c
|
|
@@ -175,7 +175,7 @@
|
|
}
|
|
VERBOSE(stdout, "%u: %s\n", i, GUID_to_str(e.type_GUID));
|
|
|
|
- tmpp = calloc(sizeof(PedPartition), 1);
|
|
+ tmpp = calloc(1, sizeof(PedPartition));
|
|
if (!tmpp) {
|
|
VERBOSE(stderr, "Out of memory\n");
|
|
return;
|
|
@@ -234,7 +234,7 @@
|
|
partition, lognum + 1);
|
|
continue;
|
|
}
|
|
- partition->next = calloc(sizeof(PedPartition), 1);
|
|
+ partition->next = calloc(1, sizeof(PedPartition));
|
|
if (!partition->next) {
|
|
goto scl_out_of_mem;
|
|
}
|
|
@@ -313,7 +313,7 @@
|
|
efihdr.partitions, dev);
|
|
break;
|
|
}
|
|
- tmp = calloc(sizeof(PedPartition), 1);
|
|
+ tmp = calloc(1, sizeof(PedPartition));
|
|
if (!tmp) {
|
|
goto cpt_out_of_mem;
|
|
}
|
|
@@ -449,7 +449,7 @@
|
|
}
|
|
}
|
|
/* This is a block device, so add it to the list*/
|
|
- PedDevice *dev = calloc(sizeof(PedDevice), 1);
|
|
+ PedDevice *dev = calloc(1, sizeof(PedDevice));
|
|
if (!dev) {
|
|
continue;
|
|
}
|