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 <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@osnexus.com>
Closes #7405
This commit is contained in:
Tomohiro Kusumi
2018-04-13 02:50:39 +09:00
committed by Brian Behlendorf
parent 7403d0743e
commit 8111eb4abc
6 changed files with 15 additions and 15 deletions
+4 -4
View File
@@ -61,7 +61,7 @@ register_fstype(const char *name, const sa_share_ops_t *ops)
{
sa_fstype_t *fstype;
fstype = calloc(sizeof (sa_fstype_t), 1);
fstype = calloc(1, sizeof (sa_fstype_t));
if (fstype == NULL)
return (NULL);
@@ -83,7 +83,7 @@ sa_init(int init_service)
{
sa_handle_impl_t impl_handle;
impl_handle = calloc(sizeof (struct sa_handle_impl), 1);
impl_handle = calloc(1, sizeof (struct sa_handle_impl));
if (impl_handle == NULL)
return (NULL);
@@ -713,7 +713,7 @@ alloc_share(const char *sharepath)
{
sa_share_impl_t impl_share;
impl_share = calloc(sizeof (struct sa_share_impl), 1);
impl_share = calloc(1, sizeof (struct sa_share_impl));
if (impl_share == NULL)
return (NULL);
@@ -725,7 +725,7 @@ alloc_share(const char *sharepath)
return (NULL);
}
impl_share->fsinfo = calloc(sizeof (sa_share_fsinfo_t), fstypes_count);
impl_share->fsinfo = calloc(fstypes_count, sizeof (sa_share_fsinfo_t));
if (impl_share->fsinfo == NULL) {
free(impl_share->sharepath);