Re: [PATCH] net: liquidio: fix a NULL pointer dereference

2019-03-10 Thread David Miller
From: Kangjie Lu 
Date: Sun, 10 Mar 2019 03:19:15 -0500

> + netif_info(lio, rx_err, lio->netdev,
> + "Failed to allocate octeon_soft_command\n");

When a function call straddles mutliple lines, the second and subsequent lines
containing argument must start precisely at the first column after the openning
parenthesis of the first line.

You must use the appropriate number of TAB and SPACE characters necessary to
achieve this.


[PATCH] net: liquidio: fix a NULL pointer dereference

2019-03-10 Thread Kangjie Lu
In case octeon_alloc_soft_command fails, the fix reports the
error and returns to avoid NULL pointer dereference.

Signed-off-by: Kangjie Lu 
---
 drivers/net/ethernet/cavium/liquidio/lio_main.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c 
b/drivers/net/ethernet/cavium/liquidio/lio_main.c
index 9b7819fdc9de..a3781d7a7b5c 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c
@@ -1192,6 +1192,11 @@ static void send_rx_ctrl_cmd(struct lio *lio, int 
start_stop)
sc = (struct octeon_soft_command *)
octeon_alloc_soft_command(oct, OCTNET_CMD_SIZE,
  16, 0);
+   if (!sc) {
+   netif_info(lio, rx_err, lio->netdev,
+   "Failed to allocate octeon_soft_command\n");
+   return;
+   }
 
ncmd = (union octnet_cmd *)sc->virtdptr;
 
-- 
2.17.1