diff options
author | harti <harti@FreeBSD.org> | 2003-07-29 13:32:10 +0000 |
---|---|---|
committer | harti <harti@FreeBSD.org> | 2003-07-29 13:32:10 +0000 |
commit | e57d86c1ec38c63f22ddae8025c1dbc035586faa (patch) | |
tree | 676fa306ffbf8bb59c756cf9a9bb95f16ae21cd4 /sys/netatm/uni | |
parent | 0b9b67134272377bf22b1b9f1092a5da3d74f251 (diff) | |
download | FreeBSD-src-e57d86c1ec38c63f22ddae8025c1dbc035586faa.zip FreeBSD-src-e57d86c1ec38c63f22ddae8025c1dbc035586faa.tar.gz |
Make the ioctl() interface cleaner with regard to types: use size_t
instead of int where the variable has to hold buffer lengths,
use u_int for things like number of network interfaces which
in principle can never be negative.
Diffstat (limited to 'sys/netatm/uni')
-rw-r--r-- | sys/netatm/uni/uniarp.c | 19 | ||||
-rw-r--r-- | sys/netatm/uni/uniarp_cache.c | 2 | ||||
-rw-r--r-- | sys/netatm/uni/unisig_if.c | 3 |
3 files changed, 14 insertions, 10 deletions
diff --git a/sys/netatm/uni/uniarp.c b/sys/netatm/uni/uniarp.c index 721e4a9..b593199 100644 --- a/sys/netatm/uni/uniarp.c +++ b/sys/netatm/uni/uniarp.c @@ -864,7 +864,9 @@ uniarp_ioctl(code, data, arg1) struct in_addr ip; Atm_addr atmsub; u_long dst; - int err = 0, i, buf_len; + int err = 0; + size_t buf_len, tlen; + u_int i; caddr_t buf_addr; switch (code) { @@ -962,7 +964,7 @@ uniarp_ioctl(code, data, arg1) */ if (asp->asr_arp_addr.address_format == T_ATM_ABSENT) { i = asp->asr_arp_plen / sizeof(struct uniarp_prf); - if (i <= 0) { + if (i == 0) { err = EINVAL; break; } @@ -1215,16 +1217,17 @@ updbuf: * Copy the prefix list into the user's buffer */ if (uip->uip_nprefix) { - i = uip->uip_nprefix - * sizeof(struct uniarp_prf); - if (buf_len < i) { + tlen = uip->uip_nprefix * + sizeof(struct uniarp_prf); + if (buf_len < tlen) { err = ENOSPC; break; } - if ((err = copyout(uip->uip_prefix, buf_addr, i)) != 0) + err = copyout(uip->uip_prefix, buf_addr, tlen); + if (err != 0) break; - buf_addr += i; - buf_len -= i; + buf_addr += tlen; + buf_len -= tlen; } } diff --git a/sys/netatm/uni/uniarp_cache.c b/sys/netatm/uni/uniarp_cache.c index 10b7118..3aba40a 100644 --- a/sys/netatm/uni/uniarp_cache.c +++ b/sys/netatm/uni/uniarp_cache.c @@ -406,7 +406,7 @@ uniarp_validate_ip(uip, ip, origin) u_int origin; { struct uniarp_prf *upp; - int i; + u_int i; /* diff --git a/sys/netatm/uni/unisig_if.c b/sys/netatm/uni/unisig_if.c index 9853b8a..30846e1 100644 --- a/sys/netatm/uni/unisig_if.c +++ b/sys/netatm/uni/unisig_if.c @@ -822,7 +822,8 @@ unisig_ioctl(code, data, arg1) struct atm_pif *pip; Atm_connection *cop; u_int vpi, vci; - int err = 0, buf_len, i; + int err = 0, i; + size_t buf_len; caddr_t buf_addr; ATM_DEBUG1("unisig_ioctl: code=%d\n", code); |