diff options
author | Tomohiro Kusumi <[email protected]> | 2018-04-13 02:50:39 +0900 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-04-12 10:50:39 -0700 |
commit | 8111eb4abc96a173845a553dc7d65382398f0683 (patch) | |
tree | eca13f7bad728d865cffe4131dac3962f52b29ef /lib/libefi | |
parent | 7403d0743e2b75b7f5412a14007ba159efb67a7d (diff) |
Fix calloc(3) arguments order
calloc(3) takes `nelem` (or `nmemb` in glibc) first, and then size of
elements. No difference expected for having these in reverse order,
however should follow the standard.
http://pubs.opengroup.org/onlinepubs/009695399/functions/calloc.html
Reviewed-by: Tony Hutter <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tomohiro Kusumi <[email protected]>
Closes #7405
Diffstat (limited to 'lib/libefi')
-rw-r--r-- | lib/libefi/rdwr_efi.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libefi/rdwr_efi.c b/lib/libefi/rdwr_efi.c index 7935047eb..e8a5ddd31 100644 --- a/lib/libefi/rdwr_efi.c +++ b/lib/libefi/rdwr_efi.c @@ -218,7 +218,7 @@ efi_get_info(int fd, struct dk_cinfo *dki_info) memset(dki_info, 0, sizeof (*dki_info)); - path = calloc(PATH_MAX, 1); + path = calloc(1, PATH_MAX); if (path == NULL) goto error; @@ -403,7 +403,7 @@ efi_alloc_and_init(int fd, uint32_t nparts, struct dk_gpt **vtoc) length = sizeof (struct dk_gpt) + sizeof (struct dk_part) * (nparts - 1); - if ((*vtoc = calloc(length, 1)) == NULL) + if ((*vtoc = calloc(1, length)) == NULL) return (-1); vptr = *vtoc; @@ -440,7 +440,7 @@ efi_alloc_and_read(int fd, struct dk_gpt **vtoc) nparts = EFI_MIN_ARRAY_SIZE / sizeof (efi_gpe_t); length = (int) sizeof (struct dk_gpt) + (int) sizeof (struct dk_part) * (nparts - 1); - if ((*vtoc = calloc(length, 1)) == NULL) + if ((*vtoc = calloc(1, length)) == NULL) return (VT_ERROR); (*vtoc)->efi_nparts = nparts; |