]> git.baikalelectronics.ru Git - kernel.git/commit
ipv4: nexthop: Fix deadcode issue by performing a proper NULL check
authorPatrick Eigensatz <patrickeigensatz@gmail.com>
Mon, 1 Jun 2020 11:12:01 +0000 (13:12 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 1 Jun 2020 18:05:35 +0000 (11:05 -0700)
commit0e587ab1f2d256aa37e69d2e9eec8b5c834b04b8
treed59bf4e8f60ebc1603d125d25c9290672993275c
parent40d30a160eb27f78a43270e2b6a300dd264e62c4
ipv4: nexthop: Fix deadcode issue by performing a proper NULL check

After allocating the spare nexthop group it should be tested for kzalloc()
returning NULL, instead the already used nexthop group (which cannot be
NULL at this point) had been tested so far.

Additionally, if kzalloc() fails, return ERR_PTR(-ENOMEM) instead of NULL.

Coverity-id: 1463885
Reported-by: Coverity <scan-admin@coverity.com>
Signed-off-by: Patrick Eigensatz <patrickeigensatz@gmail.com>
Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/nexthop.c