From a7e3c096fa8ad06916736abe2067250ff6b06ef7 Mon Sep 17 00:00:00 2001 From: Xuan Zhuo Date: Thu, 3 Sep 2020 09:47:29 +0800 Subject: [PATCH 2067/2944] alinux: tcp_rt module: fix bug of using vfree to release the memory obtained by kmalloc to #30288477 kernel test robot report this error: net/ipv4/tcp_rt/output.c: In function 'tcp_rt_get_local_statis': >> net/ipv4/tcp_rt/output.c:99:4: error: implicit declaration of function 'vfree'; did you mean 'kfree'? [-Werror=implicit-function-declaration] 99 | vfree(p); | ^~~~~ | kfree net/ipv4/tcp_rt/output.c: In function 'tcp_rt_log_printk': net/ipv4/tcp_rt/output.c:144:6: warning: variable 'start_time' set but not used [-Wunused-but-set-variable] 144 | u32 start_time, mrtt; | ^~~~~~~~~~ cc1: some warnings being treated as errors Reported-by: kernel test robot Signed-off-by: Xuan Zhuo Acked-by: Dust Li --- net/ipv4/tcp_rt/output.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/ipv4/tcp_rt/output.c b/net/ipv4/tcp_rt/output.c index 09c1e97..43908ed 100644 --- a/net/ipv4/tcp_rt/output.c +++ b/net/ipv4/tcp_rt/output.c @@ -96,7 +96,7 @@ static struct tcp_rt_stats *tcp_rt_get_stats(struct tcp_rt_stats **stats, memset(p, 0, CHUNK_SIZE); if (cmpxchg(&stats[chunkid], NULL, p)) { - vfree(p); + kfree(p); p = READ_ONCE(stats[chunkid]); } } @@ -141,12 +141,10 @@ void tcp_rt_log_printk(const struct sock *sk, char flag, bool fin, bool stats) u32 t_rt; u32 t_seq, t_retrans, recv; struct timespec64 now; - u32 start_time, mrtt; + u32 mrtt; mrtt = tcp_min_rtt(tp); - start_time = rt->start_time.tv_sec; - switch (flag) { case LOG_STATUS_R: t_rt = timespec64_dec(rt->end_time, rt->start_time); -- 1.8.3.1