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 | |
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')
-rw-r--r-- | sys/dev/sound/clone.c | 2 | ||||
-rw-r--r-- | sys/dev/sound/pci/atiixp.c | 2 | ||||
-rw-r--r-- | sys/dev/sound/pci/emu10kx.c | 2 | ||||
-rw-r--r-- | sys/dev/sound/pci/es137x.c | 10 | ||||
-rw-r--r-- | sys/dev/sound/pci/hda/hdac.c | 6 | ||||
-rw-r--r-- | sys/dev/sound/pci/via8233.c | 6 | ||||
-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 |
13 files changed, 32 insertions, 32 deletions
diff --git a/sys/dev/sound/clone.c b/sys/dev/sound/clone.c index 51316af..8b96443 100644 --- a/sys/dev/sound/clone.c +++ b/sys/dev/sound/clone.c @@ -148,7 +148,7 @@ sysctl_hw_snd_timestamp_precision(SYSCTL_HANDLER_ARGS) int err, val; val = snd_timestamp_precision; - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err == 0 && req->newptr != NULL) { switch (val) { case SND_TSP_SEC: diff --git a/sys/dev/sound/pci/atiixp.c b/sys/dev/sound/pci/atiixp.c index cfbde70..325e506 100644 --- a/sys/dev/sound/pci/atiixp.c +++ b/sys/dev/sound/pci/atiixp.c @@ -957,7 +957,7 @@ sysctl_atiixp_polling(SYSCTL_HANDLER_ARGS) atiixp_lock(sc); val = sc->polling; atiixp_unlock(sc); - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err || req->newptr == NULL) return (err); diff --git a/sys/dev/sound/pci/emu10kx.c b/sys/dev/sound/pci/emu10kx.c index f455120..42e9bbd 100644 --- a/sys/dev/sound/pci/emu10kx.c +++ b/sys/dev/sound/pci/emu10kx.c @@ -1449,7 +1449,7 @@ sysctl_emu_mixer_control(SYSCTL_HANDLER_ARGS) mixer_id = arg2; new_vol = emumix_get_volume(sc, mixer_id); - err = sysctl_handle_int(oidp, &new_vol, sizeof(new_vol), req); + err = sysctl_handle_int(oidp, &new_vol, 0, req); if (err || req->newptr == NULL) return (err); diff --git a/sys/dev/sound/pci/es137x.c b/sys/dev/sound/pci/es137x.c index ec6cc75..e7f1655 100644 --- a/sys/dev/sound/pci/es137x.c +++ b/sys/dev/sound/pci/es137x.c @@ -1375,7 +1375,7 @@ sysctl_es137x_spdif_enable(SYSCTL_HANDLER_ARGS) r = es_rd(es, ES1370_REG_STATUS, 4); ES_UNLOCK(es); new_en = (r & ENABLE_SPDIF) ? 1 : 0; - err = sysctl_handle_int(oidp, &new_en, sizeof(new_en), req); + err = sysctl_handle_int(oidp, &new_en, 0, req); if (err || req->newptr == NULL) return (err); @@ -1412,7 +1412,7 @@ sysctl_es137x_latency_timer(SYSCTL_HANDLER_ARGS) ES_LOCK(es); val = pci_read_config(dev, PCIR_LATTIMER, 1); ES_UNLOCK(es); - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err || req->newptr == NULL) return (err); @@ -1441,7 +1441,7 @@ sysctl_es137x_fixed_rate(SYSCTL_HANDLER_ARGS) if (val < es_caps.minspeed) val = 0; ES_UNLOCK(es); - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err || req->newptr == NULL) return (err); @@ -1496,7 +1496,7 @@ sysctl_es137x_single_pcm_mixer(SYSCTL_HANDLER_ARGS) set = ES_SINGLE_PCM_MIX(es->escfg); val = set; ES_UNLOCK(es); - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err || req->newptr == NULL) return (err); @@ -1571,7 +1571,7 @@ sysctl_es_polling(SYSCTL_HANDLER_ARGS) ES_LOCK(es); val = es->polling; ES_UNLOCK(es); - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err || req->newptr == NULL) return (err); diff --git a/sys/dev/sound/pci/hda/hdac.c b/sys/dev/sound/pci/hda/hdac.c index 7ae9342..4968900 100644 --- a/sys/dev/sound/pci/hda/hdac.c +++ b/sys/dev/sound/pci/hda/hdac.c @@ -5723,7 +5723,7 @@ sysctl_hdac_polling(SYSCTL_HANDLER_ARGS) hdac_lock(sc); val = sc->polling; hdac_unlock(sc); - 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); @@ -5782,7 +5782,7 @@ sysctl_hdac_polling_interval(SYSCTL_HANDLER_ARGS) hdac_lock(sc); val = ((uint64_t)sc->poll_ival * 1000) / hz; hdac_unlock(sc); - 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); @@ -5822,7 +5822,7 @@ sysctl_hdac_dump(SYSCTL_HANDLER_ARGS) devinfo->codec->sc == NULL) return (EINVAL); 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) return (err); sc = devinfo->codec->sc; diff --git a/sys/dev/sound/pci/via8233.c b/sys/dev/sound/pci/via8233.c index 829582f..a8b9057 100644 --- a/sys/dev/sound/pci/via8233.c +++ b/sys/dev/sound/pci/via8233.c @@ -165,7 +165,7 @@ sysctl_via8233_spdif_enable(SYSCTL_HANDLER_ARGS) r = pci_read_config(dev, VIA_PCI_SPDIF, 1); snd_mtxunlock(via->lock); new_en = (r & VIA_SPDIF_EN) ? 1 : 0; - err = sysctl_handle_int(oidp, &new_en, sizeof(new_en), req); + err = sysctl_handle_int(oidp, &new_en, 0, req); if (err || req->newptr == NULL) return (err); @@ -195,7 +195,7 @@ sysctl_via8233_dxs_src(SYSCTL_HANDLER_ARGS) snd_mtxlock(via->lock); val = via->dxs_src; snd_mtxunlock(via->lock); - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err || req->newptr == NULL) return (err); @@ -223,7 +223,7 @@ sysctl_via_polling(SYSCTL_HANDLER_ARGS) snd_mtxlock(via->lock); val = via->polling; snd_mtxunlock(via->lock); - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err || req->newptr == NULL) return (err); 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) { |