]> git.baikalelectronics.ru Git - kernel.git/commit
net: sparx5: switchdev: fix possible NULL pointer dereference
authorZheng Yongjun <zhengyongjun3@huawei.com>
Sat, 26 Mar 2022 08:12:39 +0000 (08:12 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 26 Mar 2022 18:49:09 +0000 (11:49 -0700)
commit794e5ea5b4ff7f05fd7e3524e91764397c68e211
tree85f92e039959014d522db31c4a1ad70d9c79f5a3
parent28b0eaddf0d56aed90a6aa1d8c2f811b5fe88912
net: sparx5: switchdev: fix possible NULL pointer dereference

As the possible failure of the allocation, devm_kzalloc() may return NULL
pointer.
Therefore, it should be better to check the 'db' in order to prevent
the dereference of NULL pointer.

Fixes: 02d0dd392b623 ("net: sparx5: switchdev: adding frame DMA functionality")
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/microchip/sparx5/sparx5_fdma.c