]> git.itanic.dy.fi Git - linux-stable/commit
net: ipa: avoid a null pointer dereference
authorAlex Elder <elder@linaro.org>
Wed, 16 Nov 2022 22:37:18 +0000 (16:37 -0600)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Nov 2022 11:46:18 +0000 (11:46 +0000)
commit15b4f993d12b5bb81f50a1ce0693343fb7a94fcf
tree3875c6c2eb3a91bab272eb82d95d7fc3efc7238b
parentc609d739947894d7370eae4cf04eb2c49e910bcf
net: ipa: avoid a null pointer dereference

Dan Carpenter reported that Smatch found an instance where a pointer
which had previously been assumed could be null (as indicated by a
null check) was later dereferenced without a similar check.

In practice this doesn't lead to a problem because currently the
pointers used are all non-null.  Nevertheless this patch addresses
the reported problem.

In addition, I spotted another bug that arose in the same commit.
When the command to initialize a routing table memory region was
added, the number of entries computed for the non-hashed table
was wrong (it ended up being a Boolean rather than the count
intended).  This bug is fixed here as well.

Reported-by: Dan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/kernel-janitors/Y3OOP9dXK6oEydkf@kili
Tested-by: Caleb Connolly <caleb.connolly@linaro.com>
Fixes: 5cb76899fb47 ("net: ipa: reduce arguments to ipa_table_init_add()")
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ipa/ipa_table.c