aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libshare
diff options
context:
space:
mode:
authorTomohiro Kusumi <[email protected]>2018-04-13 02:50:39 +0900
committerBrian Behlendorf <[email protected]>2018-04-12 10:50:39 -0700
commit8111eb4abc96a173845a553dc7d65382398f0683 (patch)
treeeca13f7bad728d865cffe4131dac3962f52b29ef /lib/libshare
parent7403d0743e2b75b7f5412a14007ba159efb67a7d (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/libshare')
-rw-r--r--lib/libshare/libshare.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libshare/libshare.c b/lib/libshare/libshare.c
index 022df016f..0965911cf 100644
--- a/lib/libshare/libshare.c
+++ b/lib/libshare/libshare.c
@@ -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);