diff options
author | dwmalone <dwmalone@FreeBSD.org> | 2007-06-04 18:25:08 +0000 |
---|---|---|
committer | dwmalone <dwmalone@FreeBSD.org> | 2007-06-04 18:25:08 +0000 |
commit | 771efb08f5bfaf22da0498ae91647fdecb3cc6bb (patch) | |
tree | e4320a83dea3de4df605896db823e0af0f883364 /sys/dev/sound/pcm | |
parent | 360dc5b21c582598a9aaf5b3cd6f3832b847ef41 (diff) | |
download | FreeBSD-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/dev/sound/pcm')
-rw-r--r-- | sys/dev/sound/pcm/ac97.c | 2 | ||||
-rw-r--r-- | sys/dev/sound/pcm/channel.c | 6 | ||||
-rw-r--r-- | sys/dev/sound/pcm/feeder.c | 2 | ||||
-rw-r--r-- | sys/dev/sound/pcm/feeder_rate.c | 6 | ||||
-rw-r--r-- | sys/dev/sound/pcm/sndstat.c | 4 | ||||
-rw-r--r-- | sys/dev/sound/pcm/sound.c | 14 | ||||
-rw-r--r-- | sys/dev/sound/pcm/vchan.c | 2 |
7 files changed, 18 insertions, 18 deletions
diff --git a/sys/dev/sound/pcm/ac97.c b/sys/dev/sound/pcm/ac97.c index 279d5e5..44c947c 100644 --- a/sys/dev/sound/pcm/ac97.c +++ b/sys/dev/sound/pcm/ac97.c @@ -880,7 +880,7 @@ sysctl_hw_snd_ac97_eapd(SYSCTL_HANDLER_ARGS) inv = (codec->flags & AC97_F_EAPD_INV) ? 0 : 1; ea = (val >> 15) ^ inv; snd_mtxunlock(codec->lock); - err = sysctl_handle_int(oidp, &ea, sizeof(ea), req); + err = sysctl_handle_int(oidp, &ea, 0, req); if (err == 0 && req->newptr != NULL) { if (ea != 0 && ea != 1) return EINVAL; diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index f5753b1..c9831ff 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -70,7 +70,7 @@ sysctl_hw_snd_latency(SYSCTL_HANDLER_ARGS) int err, val; val = chn_latency; - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err != 0 || req->newptr == NULL) return err; if (val < CHN_LATENCY_MIN || val > CHN_LATENCY_MAX) @@ -93,7 +93,7 @@ sysctl_hw_snd_latency_profile(SYSCTL_HANDLER_ARGS) int err, val; val = chn_latency_profile; - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err != 0 || req->newptr == NULL) return err; if (val < CHN_LATENCY_PROFILE_MIN || val > CHN_LATENCY_PROFILE_MAX) @@ -116,7 +116,7 @@ sysctl_hw_snd_timeout(SYSCTL_HANDLER_ARGS) int err, val; val = chn_timeout; - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err != 0 || req->newptr == NULL) return err; if (val < CHN_TIMEOUT_MIN || val > CHN_TIMEOUT_MAX) diff --git a/sys/dev/sound/pcm/feeder.c b/sys/dev/sound/pcm/feeder.c index 8e97960..fefbc92 100644 --- a/sys/dev/sound/pcm/feeder.c +++ b/sys/dev/sound/pcm/feeder.c @@ -45,7 +45,7 @@ sysctl_hw_snd_feeder_buffersize(SYSCTL_HANDLER_ARGS) int i, err, val; val = feeder_buffersize; - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err != 0 || req->newptr == NULL) return err; diff --git a/sys/dev/sound/pcm/feeder_rate.c b/sys/dev/sound/pcm/feeder_rate.c index 14cca55..79f06f1 100644 --- a/sys/dev/sound/pcm/feeder_rate.c +++ b/sys/dev/sound/pcm/feeder_rate.c @@ -130,7 +130,7 @@ sysctl_hw_snd_feeder_rate_min(SYSCTL_HANDLER_ARGS) int err, val; val = feeder_rate_min; - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err != 0 || req->newptr == NULL) return (err); if (RATE_FACTOR_SAFE(val) && val < feeder_rate_max) @@ -149,7 +149,7 @@ sysctl_hw_snd_feeder_rate_max(SYSCTL_HANDLER_ARGS) int err, val; val = feeder_rate_max; - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err != 0 || req->newptr == NULL) return (err); if (RATE_FACTOR_SAFE(val) && val > feeder_rate_min) @@ -168,7 +168,7 @@ sysctl_hw_snd_feeder_rate_round(SYSCTL_HANDLER_ARGS) int err, val; val = feeder_rate_round; - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err != 0 || req->newptr == NULL) return (err); if (val < FEEDRATE_ROUNDHZ_MIN || val > FEEDRATE_ROUNDHZ_MAX) diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c index c07e1de..db65989 100644 --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -99,7 +99,7 @@ sysctl_hw_snd_sndstat_pid(SYSCTL_HANDLER_ARGS) mtx_lock(&sndstat_lock); val = (int)SNDSTAT_PID(sndstat_dev); mtx_unlock(&sndstat_lock); - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err == 0 && req->newptr != NULL && val == 0) { mtx_lock(&sndstat_lock); SNDSTAT_FLUSH(); @@ -120,7 +120,7 @@ sysctl_hw_sndverbose(SYSCTL_HANDLER_ARGS) int error, verbose; verbose = snd_verbose; - error = sysctl_handle_int(oidp, &verbose, sizeof(verbose), req); + error = sysctl_handle_int(oidp, &verbose, 0, req); if (error == 0 && req->newptr != NULL) { mtx_lock(&sndstat_lock); if (verbose < 0 || verbose > 4) diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index dee3c99..4f6d078 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -441,7 +441,7 @@ sysctl_hw_snd_default_unit(SYSCTL_HANDLER_ARGS) int error, unit; unit = snd_unit; - error = sysctl_handle_int(oidp, &unit, sizeof(unit), req); + error = sysctl_handle_int(oidp, &unit, 0, req); if (error == 0 && req->newptr != NULL) { d = devclass_get_softc(pcm_devclass, unit); if (d == NULL || CHN_EMPTY(d, channels.pcm)) @@ -462,7 +462,7 @@ sysctl_hw_snd_maxautovchans(SYSCTL_HANDLER_ARGS) int i, v, error; v = snd_maxautovchans; - error = sysctl_handle_int(oidp, &v, sizeof(v), req); + error = sysctl_handle_int(oidp, &v, 0, req); if (error == 0 && req->newptr != NULL) { if (v < 0) v = 0; @@ -840,7 +840,7 @@ sysctl_dev_pcm_clone_flags(SYSCTL_HANDLER_ARGS) pcm_lock(d); flags = snd_clone_getflags(d->clones); pcm_unlock(d); - err = sysctl_handle_int(oidp, (int *)(&flags), sizeof(flags), req); + err = sysctl_handle_int(oidp, &flags, 0, req); if (err == 0 && req->newptr != NULL) { if ((flags & ~SND_CLONE_MASK)) @@ -868,7 +868,7 @@ sysctl_dev_pcm_clone_deadline(SYSCTL_HANDLER_ARGS) pcm_lock(d); deadline = snd_clone_getdeadline(d->clones); pcm_unlock(d); - err = sysctl_handle_int(oidp, &deadline, sizeof(deadline), req); + err = sysctl_handle_int(oidp, &deadline, 0, req); if (err == 0 && req->newptr != NULL) { if (deadline < 0) @@ -894,7 +894,7 @@ sysctl_dev_pcm_clone_gc(SYSCTL_HANDLER_ARGS) return (ENODEV); val = 0; - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err == 0 && req->newptr != NULL && val != 0) { pcm_lock(d); @@ -912,7 +912,7 @@ sysctl_hw_snd_clone_gc(SYSCTL_HANDLER_ARGS) int i, err, val; val = 0; - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err == 0 && req->newptr != NULL && val != 0) { for (i = 0; pcm_devclass != NULL && @@ -1275,7 +1275,7 @@ sysctl_hw_snd_vchans(SYSCTL_HANDLER_ARGS) } newcnt = vchancount; - err = sysctl_handle_int(oidp, &newcnt, sizeof(newcnt), req); + err = sysctl_handle_int(oidp, &newcnt, 0, req); if (err == 0 && req->newptr != NULL && vchancount != newcnt) { if (newcnt < 0) diff --git a/sys/dev/sound/pcm/vchan.c b/sys/dev/sound/pcm/vchan.c index 8e7c865..28f4a4a 100644 --- a/sys/dev/sound/pcm/vchan.c +++ b/sys/dev/sound/pcm/vchan.c @@ -577,7 +577,7 @@ sysctl_hw_snd_vchanrate(SYSCTL_HANDLER_ARGS) pcm_inprog(d, -1); return (EINVAL); } - err = sysctl_handle_int(oidp, &newspd, sizeof(newspd), req); + err = sysctl_handle_int(oidp, &newspd, 0, req); if (err == 0 && req->newptr != NULL) { if (newspd < 1 || newspd < feeder_rate_min || newspd > feeder_rate_max) { |