Skip to content

Commit b4f4348

Browse files
GustavoARSilvadavem330
authored andcommitted
dpaa2-mac: Fix potential null pointer dereference
There is a null-check for _pcs_, but it is being dereferenced prior to this null-check. So, if _pcs_ can actually be null, then there is a potential null pointer dereference that should be fixed by null-checking _pcs_ before being dereferenced. Addresses-Coverity-ID: 1497159 ("Dereference before null check") Fixes: 94ae899 ("dpaa2-mac: add PCS support through the Lynx module") Signed-off-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9b69e5e commit b4f4348

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,9 @@ static int dpaa2_pcs_create(struct dpaa2_mac *mac,
290290
static void dpaa2_pcs_destroy(struct dpaa2_mac *mac)
291291
{
292292
struct lynx_pcs *pcs = mac->pcs;
293-
struct device *dev = &pcs->mdio->dev;
294293

295294
if (pcs) {
295+
struct device *dev = &pcs->mdio->dev;
296296
lynx_pcs_destroy(pcs);
297297
put_device(dev);
298298
mac->pcs = NULL;

0 commit comments

Comments
 (0)