Hi,
I noticed one instance where the size given to free(9) can easily be
determined. While here, this diff also removes an outdated comment
(since r1.230) as well as a dead initialisation in rtm_addr().
Index: src/sys/net/rtsock.c
===================================================================
RCS file: /cvs/src/sys/net/rtsock.c,v
retrieving revision 1.255
diff -u -p -r1.255 rtsock.c
--- src/sys/net/rtsock.c 3 Nov 2017 16:23:20 -0000 1.255
+++ src/sys/net/rtsock.c 7 Dec 2017 06:16:04 -0000
@@ -224,7 +224,7 @@ route_attach(struct socket *so, int prot
if (curproc == NULL)
error = EACCES;
- else
+ else
error = soreserve(so, RAWSNDQ, RAWRCVQ);
if (error) {
free(rop, M_PCB, sizeof(struct routecb));
@@ -694,12 +694,6 @@ route_output(struct mbuf *m, struct sock
}
/*
- * Do not use goto flush before this point since the message itself
- * may be not consistent and could cause unexpected behaviour in other
- * userland clients. Use goto fail instead.
- */
-
- /*
* Validate RTM_PROPOSAL and pass it along or error out.
*/
if (rtm->rtm_type == RTM_PROPOSAL) {
@@ -712,7 +706,7 @@ route_output(struct mbuf *m, struct sock
if (!error) {
type = rtm->rtm_type;
seq = rtm->rtm_seq;
- free(rtm, M_RTABLE, 0);
+ free(rtm, M_RTABLE, len);
rtm = rtm_report(rt, type, seq, tableid);
}
}
@@ -897,7 +891,7 @@ rtm_output(struct rt_msghdr *rtm, struct
*/
plen = rtable_satoplen(info->rti_info[RTAX_DST]->sa_family,
info->rti_info[RTAX_NETMASK]);
- if (rt_plen(rt) != plen ) {
+ if (rt_plen(rt) != plen) {
error = ESRCH;
break;
}
@@ -1491,7 +1485,7 @@ void
rtm_addr(struct rtentry *rt, int cmd, struct ifaddr *ifa)
{
struct ifnet *ifp = ifa->ifa_ifp;
- struct mbuf *m = NULL;
+ struct mbuf *m;
struct rt_addrinfo info;
struct ifa_msghdr *ifam;
Regards,
kshe