
From: Xu Jia <xujia39@huawei.com> hulk inclusion category: bugfix bugzilla: 177871 CVE: CVE-2021-20322 ------------------------------------------------- The following warning is falsely reported since commit e2eea86ca197 (ipv4: make exception cache less predictible): error: ‘oldest_p’ may be used uninitialized in this function [-Werror=maybe-uninitialized] *oldest_p = oldest->fnhe_next; ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ net/ipv4/route.c:602:44: note: ‘oldest_p’ was declared here struct fib_nh_exception __rcu **fnhe_p, **oldest_p; Fix and avoid the alarm. Signed-off-by: Xu Jia <xujia39@huawei.com> Reviewed-by: Yue Haibing <yuehaibing@huawei.com> Reviewed-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> --- net/ipv4/route.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/net/ipv4/route.c b/net/ipv4/route.c index a7828f85afb2d..ea36811ec0d7d 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -616,9 +616,11 @@ static void fnhe_remove_oldest(struct fnhe_hash_bucket *hash) oldest_p = fnhe_p; } } - fnhe_flush_routes(oldest); - *oldest_p = oldest->fnhe_next; - kfree_rcu(oldest, rcu); + if (oldest) { + fnhe_flush_routes(oldest); + *oldest_p = oldest->fnhe_next; + kfree_rcu(oldest, rcu); + } } static u32 fnhe_hashfun(__be32 daddr) -- 2.25.1