]> 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)
commit69b849c240040b8105c02a14dc8a911dc943ffbf
treed59bf4e8f60ebc1603d125d25c9290672993275c
parentda25e8f99cb6989ba3c5364b37df0106c4a2b204
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