16 * 64 is a bit much.
Use kmalloc_array instead.

Signed-off-by: Joe Perches <j...@perches.com>
---
 net/sunrpc/xprtrdma/verbs.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index 745973b..9cfebb4 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -1736,8 +1736,13 @@ rpcrdma_register_default_external(struct rpcrdma_mr_seg 
*seg,
        int mem_priv = (writing ? IB_ACCESS_REMOTE_WRITE :
                                  IB_ACCESS_REMOTE_READ);
        struct rpcrdma_mr_seg *seg1 = seg;
-       struct ib_phys_buf ipb[RPCRDMA_MAX_DATA_SEGS];
        int len, i, rc = 0;
+       struct ib_phys_buf *ipb = kmalloc_array(RPCRDMA_MAX_DATA_SEGS,
+                                               sizeof(*ipb),
+                                               GFP_KERNEL);
+
+       if (!ipb)
+               return -ENOMEM;
 
        if (*nsegs > RPCRDMA_MAX_DATA_SEGS)
                *nsegs = RPCRDMA_MAX_DATA_SEGS;
@@ -1770,6 +1775,9 @@ rpcrdma_register_default_external(struct rpcrdma_mr_seg 
*seg,
                seg1->mr_len = len;
        }
        *nsegs = i;
+
+       kfree(ipb);
+
        return rc;
 }
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to