]> git.baikalelectronics.ru Git - kernel.git/commit
net: dsa: felix: fix possible NULL pointer dereference
authorZheng Yongjun <zhengyongjun3@huawei.com>
Tue, 29 Mar 2022 09:08:00 +0000 (09:08 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 30 Mar 2022 19:07:38 +0000 (12:07 -0700)
commita4c02c38349d7f8ef314519815790f234e6b4e36
tree72908ac61131087d8ca82603ab1a4de659863ea9
parent2c1b730e2a03f9485241cb36f411f4ff6a50b2ff
net: dsa: felix: fix possible NULL pointer dereference

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

Fixes: 9e934777c666e ("net: dsa: felix: add stream gate settings for psfp").
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://lore.kernel.org/r/20220329090800.130106-1-zhengyongjun3@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/ocelot/felix_vsc9959.c