From: Tymoteusz Kielan Date: Mon, 25 Jul 2016 20:38:01 +0000 (-0700) Subject: IB/hfi1: Fix to fully initialize send context area X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=1b23f02cf4bbe644028077539b1045f742d61fa2;p=linux-beck.git IB/hfi1: Fix to fully initialize send context area While handling buffer control MAD, partially initialized dd->kernel_send_context area may cause potential dereference of uninitialized pointers. Fix by using kzalloc_node() instead of kmalloc_node(). Reviewed-by: Mike Marciniszyn Reviewed-by: Dennis Dalessandro Reviewed-by: Andrzej Kacprowski Signed-off-by: Tymoteusz Kielan Signed-off-by: Andrzej Kacprowski Signed-off-by: Dennis Dalessandro Signed-off-by: Doug Ledford --- diff --git a/drivers/infiniband/hw/hfi1/pio.c b/drivers/infiniband/hw/hfi1/pio.c index d4022450b73f..a99fccadf624 100644 --- a/drivers/infiniband/hw/hfi1/pio.c +++ b/drivers/infiniband/hw/hfi1/pio.c @@ -1956,7 +1956,7 @@ int init_pervl_scs(struct hfi1_devdata *dd) hfi1_init_ctxt(dd->vld[15].sc); dd->vld[15].mtu = enum_to_mtu(OPA_MTU_2048); - dd->kernel_send_context = kmalloc_node(dd->num_send_contexts * + dd->kernel_send_context = kzalloc_node(dd->num_send_contexts * sizeof(struct send_context *), GFP_KERNEL, dd->node); dd->kernel_send_context[0] = dd->vld[15].sc;