On 03.07.24 16:11, 'Quirin Gylstorff' via EFI Boot Guard wrote:
> From: Quirin Gylstorff <quirin.gylsto...@siemens.com>
> 
> This fixes a error if compiled with gcc-14. gcc-14 enables the
> compile option `-Werror=calloc-transposed-args`.
> 
> No functional change as 1*sizeof(x) is the same as sizeof(x)*1.
> 
> Found with Bug#1074932: efibootguard: ftbfs with GCC-14.
> 
> Signed-off-by: Quirin Gylstorff <quirin.gylsto...@siemens.com>
> ---
>  tools/ebgpart.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/ebgpart.c b/tools/ebgpart.c
> index 298d766..f733771 100644
> --- a/tools/ebgpart.c
> +++ b/tools/ebgpart.c
> @@ -175,7 +175,7 @@ static void read_GPT_entries(int fd, uint64_t table_LBA, 
> uint32_t num,
>               }
>               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 @@ static void scanLogicalVolumes(int fd, off64_t 
> extended_start_LBA,
>                                          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 @@ static bool check_partition_table(PedDevice *dev)
>                                        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 @@ void ped_device_probe_all(char *rootdev)
>                       }
>               }
>               /* 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;
>               }

Thanks, merged. And thanks to gcc to keep us entertained :)

Jan

-- 
Siemens AG, Technology
Linux Expert Center

-- 
You received this message because you are subscribed to the Google Groups "EFI 
Boot Guard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to efibootguard-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/efibootguard-dev/b92995de-c297-4e66-85fe-2a4eb4d97ee9%40siemens.com.

Reply via email to