diff options
author | Pedro F. Giffuni <pfg@FreeBSD.org> | 2018-01-22 02:08:10 +0000 |
---|---|---|
committer | Pedro F. Giffuni <pfg@FreeBSD.org> | 2018-01-22 02:08:10 +0000 |
commit | d821d36419a2ec7c61435759467139bde2613468 (patch) | |
tree | f469fa2de1347fb08ba66d2b41c9cab5eccfe14c /sys/netpfil | |
parent | b8d1747e755f88c678adc272fb4d356715288197 (diff) | |
download | src-d821d36419a2ec7c61435759467139bde2613468.tar.gz src-d821d36419a2ec7c61435759467139bde2613468.zip |
Unsign some values related to allocation.
When allocating memory through malloc(9), we always expect the amount of
memory requested to be unsigned as a negative value would either stand for
an error or an overflow.
Unsign some values, found when considering the use of mallocarray(9), to
avoid unnecessary casting. Also consider that indexes should be of
at least the same size/type as the upper limit they pretend to index.
MFC after: 3 weeks
Notes
Notes:
svn path=/head/; revision=328238
Diffstat (limited to 'sys/netpfil')
-rw-r--r-- | sys/netpfil/ipfw/ip_fw_sockopt.c | 2 | ||||
-rw-r--r-- | sys/netpfil/ipfw/ip_fw_table_algo.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/sys/netpfil/ipfw/ip_fw_sockopt.c b/sys/netpfil/ipfw/ip_fw_sockopt.c index 77990ad63784..94f64b848d89 100644 --- a/sys/netpfil/ipfw/ip_fw_sockopt.c +++ b/sys/netpfil/ipfw/ip_fw_sockopt.c @@ -355,7 +355,7 @@ get_map(struct ip_fw_chain *chain, int extra, int locked) for (;;) { struct ip_fw **map; - int i, mflags; + u_int i, mflags; mflags = M_ZERO | ((locked != 0) ? M_NOWAIT : M_WAITOK); diff --git a/sys/netpfil/ipfw/ip_fw_table_algo.c b/sys/netpfil/ipfw/ip_fw_table_algo.c index feb10c944f33..405be0be8285 100644 --- a/sys/netpfil/ipfw/ip_fw_table_algo.c +++ b/sys/netpfil/ipfw/ip_fw_table_algo.c @@ -3266,10 +3266,10 @@ static int ta_init_fhash(struct ip_fw_chain *ch, void **ta_state, struct table_info *ti, char *data, uint8_t tflags) { - int i; struct fhash_cfg *cfg; struct fhashentry4 *fe4; struct fhashentry6 *fe6; + u_int i; cfg = malloc(sizeof(struct fhash_cfg), M_IPFW, M_WAITOK | M_ZERO); @@ -3672,7 +3672,7 @@ ta_prepare_mod_fhash(void *ta_buf, uint64_t *pflags) { struct mod_item *mi; struct fhashbhead *head; - int i; + u_int i; mi = (struct mod_item *)ta_buf; |