Message ID | 1430937203.14545.62.camel@edumazet-glaptop2.roam.corp.google.com |
---|---|
State | Accepted, archived |
Delegated to: | stephen hemminger |
Headers | show |
On Wed, 06 May 2015 11:33:23 -0700 Eric Dumazet <eric.dumazet@gmail.com> wrote: > From: Eric Dumazet <edumazet@google.com> > > Kernel can give us smaller tcp_info than our. > > We copy the kernel provided structure and fill with 0 > the remaining part. > > Lets clear only the missing part to save some cycles, as we intend to > slightly increase tcp_info size in the future. > > Signed-off-by: Eric Dumazet <edumazet@google.com> Applied, I don't think other people will have enough sockets to notice the difference :-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/misc/ss.c b/misc/ss.c index 46dbb39..68961fc 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -1893,8 +1893,8 @@ static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r, /* workaround for older kernels with less fields */ if (len < sizeof(*info)) { info = alloca(sizeof(*info)); - memset(info, 0, sizeof(*info)); memcpy(info, RTA_DATA(tb[INET_DIAG_INFO]), len); + memset((char *)info + len, 0, sizeof(*info) - len); } else info = RTA_DATA(tb[INET_DIAG_INFO]);