diff options
author | John Levon <john.levon@joyent.com> | 2018-12-18 17:54:15 +0000 |
---|---|---|
committer | John Levon <john.levon@joyent.com> | 2019-02-08 20:20:48 +0000 |
commit | 1b58875ad7966cf2c85ee8e92f3da04f0a3b2f7a (patch) | |
tree | dbe61047954170e16d3fe146b01f280f512ac3ff /usr/src | |
parent | 0bead3cac461a1ad4d49bae1dc8a3be05110aa74 (diff) | |
download | illumos-joyent-1b58875ad7966cf2c85ee8e92f3da04f0a3b2f7a.tar.gz |
10100 Illumos is confused about calloc() arguments
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Gergő Doma <domag02@gmail.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/checknr/checknr.c | 6 | ||||
-rw-r--r-- | usr/src/cmd/sgs/librtld_db/common/rtld_db.c | 7 | ||||
-rw-r--r-- | usr/src/lib/libefi/common/rdwr_efi.c | 11 | ||||
-rw-r--r-- | usr/src/lib/libilb/common/ilb_comm.c | 4 | ||||
-rw-r--r-- | usr/src/lib/libipmi/common/libipmi.c | 4 |
5 files changed, 20 insertions, 12 deletions
diff --git a/usr/src/cmd/checknr/checknr.c b/usr/src/cmd/checknr/checknr.c index fca907e2e8..8a8683ca30 100644 --- a/usr/src/cmd/checknr/checknr.c +++ b/usr/src/cmd/checknr/checknr.c @@ -13,7 +13,9 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" +/* + * Copyright (c) 2018, Joyent, Inc. + */ /* * checknr: check an nroff/troff input file for matching macro calls. @@ -190,7 +192,7 @@ char **argv; #define TEXT_DOMAIN "SYS_TEST" #endif (void) textdomain(TEXT_DOMAIN); - stk = (struct stkstr *)calloc(sizeof (struct stkstr), 100); + stk = (struct stkstr *)calloc(100, sizeof (struct stkstr)); maxstk = 100; /* Figure out how many known commands there are */ while (knowncmds[ncmds]) diff --git a/usr/src/cmd/sgs/librtld_db/common/rtld_db.c b/usr/src/cmd/sgs/librtld_db/common/rtld_db.c index 53f90f9c60..d863c0f3f4 100644 --- a/usr/src/cmd/sgs/librtld_db/common/rtld_db.c +++ b/usr/src/cmd/sgs/librtld_db/common/rtld_db.c @@ -23,8 +23,9 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - +/* + * Copyright (c) 2018, Joyent, Inc. + */ #include <stdlib.h> #include <stdio.h> @@ -162,7 +163,7 @@ rd_new(struct ps_prochandle *php) rd_agent_t *rap; LOG(ps_plog(MSG_ORIG(MSG_DB_RDNEW), php)); - if ((rap = (rd_agent_t *)calloc(sizeof (rd_agent_t), 1)) == NULL) + if ((rap = (rd_agent_t *)calloc(1, sizeof (rd_agent_t))) == NULL) return (0); rap->rd_psp = php; diff --git a/usr/src/lib/libefi/common/rdwr_efi.c b/usr/src/lib/libefi/common/rdwr_efi.c index 18ad38f0c5..e0d866e3c4 100644 --- a/usr/src/lib/libefi/common/rdwr_efi.c +++ b/usr/src/lib/libefi/common/rdwr_efi.c @@ -24,6 +24,7 @@ * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright 2014 Toomas Soome <tsoome@me.com> * Copyright 2018 OmniOS Community Edition (OmniOSce) Association. + * Copyright (c) 2018, Joyent, Inc. */ #include <stdio.h> @@ -188,7 +189,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; @@ -229,7 +230,7 @@ efi_alloc_and_read(int fd, struct dk_gpt **vtoc) if (read_disk_info(fd, &capacity, &lbsize) != 0) return (VT_ERROR); - if ((mbr = calloc(lbsize, 1)) == NULL) + if ((mbr = calloc(1, lbsize)) == NULL) return (VT_ERROR); if ((ioctl(fd, DKIOCGMBOOT, (caddr_t)mbr)) == -1) { @@ -256,7 +257,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; @@ -423,7 +424,7 @@ efi_read(int fd, struct dk_gpt *vtoc) } } - if ((dk_ioc.dki_data = calloc(label_len, 1)) == NULL) + if ((dk_ioc.dki_data = calloc(1, label_len)) == NULL) return (VT_ERROR); dk_ioc.dki_length = disk_info.dki_lbsize; @@ -1020,7 +1021,7 @@ efi_write(int fd, struct dk_gpt *vtoc) * for backup GPT header. */ lba_backup_gpt_hdr = vtoc->efi_last_u_lba + 1 + nblocks; - if ((dk_ioc.dki_data = calloc(dk_ioc.dki_length, 1)) == NULL) + if ((dk_ioc.dki_data = calloc(1, dk_ioc.dki_length)) == NULL) return (VT_ERROR); efi = dk_ioc.dki_data; diff --git a/usr/src/lib/libilb/common/ilb_comm.c b/usr/src/lib/libilb/common/ilb_comm.c index ff8cdca3a1..afa4f184e6 100644 --- a/usr/src/lib/libilb/common/ilb_comm.c +++ b/usr/src/lib/libilb/common/ilb_comm.c @@ -22,6 +22,8 @@ /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2018, Joyent, Inc. */ #include <stdlib.h> @@ -60,7 +62,7 @@ ilb_open(ilb_handle_t *hp) if (hp == NULL) return (ILB_STATUS_EINVAL); - hi = calloc(sizeof (*hi), 1); + hi = calloc(1, sizeof (*hi)); if (hi == NULL) return (ILB_STATUS_ENOMEM); diff --git a/usr/src/lib/libipmi/common/libipmi.c b/usr/src/lib/libipmi/common/libipmi.c index 63e985755c..cf7c7e6145 100644 --- a/usr/src/lib/libipmi/common/libipmi.c +++ b/usr/src/lib/libipmi/common/libipmi.c @@ -21,6 +21,8 @@ /* * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2018, Joyent, Inc. */ #include <libipmi.h> @@ -37,7 +39,7 @@ ipmi_open(int *errp, char **msg, uint_t xport_type, nvlist_t *params) if (msg) *msg = NULL; - if ((ihp = calloc(sizeof (ipmi_handle_t), 1)) == NULL) { + if ((ihp = calloc(1, sizeof (ipmi_handle_t))) == NULL) { *errp = EIPMI_NOMEM; if (msg) *msg = "memory allocation failure"; |