]> git.baikalelectronics.ru Git - kernel.git/commit
net: macb: Add a NULL check on desc_ptp
authorHarini Katakam <harini.katakam@xilinx.com>
Tue, 24 Aug 2021 10:02:09 +0000 (15:32 +0530)
committerDavid S. Miller <davem@davemloft.net>
Wed, 25 Aug 2021 09:39:17 +0000 (10:39 +0100)
commit5bd763fed1582e9e66959463cb8f233a5077b4e0
tree09c1278ce7c20983c5f5dc25fe109fc02a53339e
parentdc4a9e30b0c4c8a5a53015dc98b4ba507bfb0307
net: macb: Add a NULL check on desc_ptp

macb_ptp_desc will not return NULL under most circumstances with correct
Kconfig and IP design config register. But for the sake of the extreme
corner case, check for NULL when using the helper. In case of rx_tstamp,
no action is necessary except to return (similar to timestamp disabled)
and warn. In case of TX, return -EINVAL to let the skb be free. Perform
this check before marking skb in progress.
Fixes coverity warning:
(4) Event dereference:
Dereferencing a null pointer "desc_ptp"

Signed-off-by: Harini Katakam <harini.katakam@xilinx.com>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cadence/macb_ptp.c