Skip to content

Commit

Permalink
drivers/ps3: Fix ps3-vuart null dereference
Browse files Browse the repository at this point in the history
On the unlikely event that drv is null, the current code will
perform a null pointer dereference with it when printing a dev_dbg
message.  Instead, the BUG_ON check on drv should be performed
before we emit the dev_dbg message.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
  • Loading branch information
Colin King authored and Michael Ellerman committed Sep 29, 2015
1 parent 12a5093 commit 6a6120b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/ps3/ps3-vuart.c
Original file line number Diff line number Diff line change
Expand Up @@ -1000,12 +1000,11 @@ static int ps3_vuart_probe(struct ps3_system_bus_device *dev)
dev_dbg(&dev->core, "%s:%d\n", __func__, __LINE__);

drv = ps3_system_bus_dev_to_vuart_drv(dev);
BUG_ON(!drv);

dev_dbg(&dev->core, "%s:%d: (%s)\n", __func__, __LINE__,
drv->core.core.name);

BUG_ON(!drv);

if (dev->port_number >= PORT_COUNT) {
BUG();
return -EINVAL;
Expand Down

0 comments on commit 6a6120b

Please sign in to comment.