summaryrefslogtreecommitdiffstats
path: root/sys/geom
diff options
context:
space:
mode:
authordwmalone <dwmalone@FreeBSD.org>2007-06-04 18:25:08 +0000
committerdwmalone <dwmalone@FreeBSD.org>2007-06-04 18:25:08 +0000
commit771efb08f5bfaf22da0498ae91647fdecb3cc6bb (patch)
treee4320a83dea3de4df605896db823e0af0f883364 /sys/geom
parent360dc5b21c582598a9aaf5b3cd6f3832b847ef41 (diff)
downloadFreeBSD-src-771efb08f5bfaf22da0498ae91647fdecb3cc6bb.zip
FreeBSD-src-771efb08f5bfaf22da0498ae91647fdecb3cc6bb.tar.gz
Despite several examples in the kernel, the third argument of
sysctl_handle_int is not sizeof the int type you want to export. The type must always be an int or an unsigned int. Remove the instances where a sizeof(variable) is passed to stop people accidently cut and pasting these examples. In a few places this was sysctl_handle_int was being used on 64 bit types, which would truncate the value to be exported. In these cases use sysctl_handle_quad to export them and change the format to Q so that sysctl(1) can still print them.
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/cache/g_cache.c2
-rw-r--r--sys/geom/journal/g_journal.c6
-rw-r--r--sys/geom/stripe/g_stripe.c2
3 files changed, 5 insertions, 5 deletions
diff --git a/sys/geom/cache/g_cache.c b/sys/geom/cache/g_cache.c
index 60b0254..7be8cb3 100644
--- a/sys/geom/cache/g_cache.c
+++ b/sys/geom/cache/g_cache.c
@@ -66,7 +66,7 @@ sysctl_handle_pct(SYSCTL_HANDLER_ARGS)
u_int val = *(u_int *)arg1;
int error;
- error = sysctl_handle_int(oidp, &val, sizeof(val), req);
+ error = sysctl_handle_int(oidp, &val, 0, req);
if (error || !req->newptr)
return (error);
if (val < 0 || val > 100)
diff --git a/sys/geom/journal/g_journal.c b/sys/geom/journal/g_journal.c
index cd9ffec..6be6580 100644
--- a/sys/geom/journal/g_journal.c
+++ b/sys/geom/journal/g_journal.c
@@ -115,7 +115,7 @@ g_journal_record_entries_sysctl(SYSCTL_HANDLER_ARGS)
int error;
entries = g_journal_record_entries;
- error = sysctl_handle_int(oidp, &entries, sizeof(entries), req);
+ error = sysctl_handle_int(oidp, &entries, 0, req);
if (error != 0 || req->newptr == NULL)
return (error);
if (entries < 1 || entries > GJ_RECORD_HEADER_NENTRIES)
@@ -150,7 +150,7 @@ g_journal_cache_limit_sysctl(SYSCTL_HANDLER_ARGS)
int error;
limit = g_journal_cache_limit;
- error = sysctl_handle_int(oidp, &limit, sizeof(limit), req);
+ error = sysctl_handle_int(oidp, &limit, 0, req);
if (error != 0 || req->newptr == NULL)
return (error);
g_journal_cache_limit = limit;
@@ -170,7 +170,7 @@ g_journal_cache_switch_sysctl(SYSCTL_HANDLER_ARGS)
int error;
cswitch = g_journal_cache_switch;
- error = sysctl_handle_int(oidp, &cswitch, sizeof(cswitch), req);
+ error = sysctl_handle_int(oidp, &cswitch, 0, req);
if (error != 0 || req->newptr == NULL)
return (error);
if (cswitch < 0 || cswitch > 100)
diff --git a/sys/geom/stripe/g_stripe.c b/sys/geom/stripe/g_stripe.c
index 3bf087f..c059df5 100644
--- a/sys/geom/stripe/g_stripe.c
+++ b/sys/geom/stripe/g_stripe.c
@@ -80,7 +80,7 @@ g_sysctl_stripe_fast(SYSCTL_HANDLER_ARGS)
int error, fast;
fast = g_stripe_fast;
- error = sysctl_handle_int(oidp, &fast, sizeof(fast), req);
+ error = sysctl_handle_int(oidp, &fast, 0, req);
if (error == 0 && req->newptr != NULL)
g_stripe_fast = fast;
return (error);
OpenPOWER on IntegriCloud