[openib-general] [PATCH] CM: fix accessing wrong msg pointer

Sean Hefty mshefty at ichips.intel.com
Thu Jan 27 11:30:36 PST 2005


This patch fixes accessing the wrong cm_msg pointer in cm_alloc_msg.

Signed-off-by: Sean Hefty <sean.hefty at intel.com>

Index: core/cm.c
===================================================================
--- core/cm.c	(revision 1668)
+++ core/cm.c	(working copy)
@@ -151,7 +151,7 @@ static int cm_alloc_msg(struct cm_id_pri
 	struct cm_msg *m;
 	int ret;
 
-	m = kmalloc(sizeof **msg, GFP_KERNEL);
+	m = kmalloc(sizeof *m, GFP_KERNEL);
 	if (!m)
 		return -ENOMEM;
 	memset(m, 0, sizeof *m);
@@ -168,11 +168,11 @@ static int cm_alloc_msg(struct cm_id_pri
 	m->sge.addr = dma_map_single(mad_agent->device->dma_device,
 				     &m->mad, sizeof m->mad,
 				     DMA_TO_DEVICE);
-	pci_unmap_addr_set(msg, mapping, m->sge.addr);
+	pci_unmap_addr_set(m, mapping, m->sge.addr);
 	m->sge.length = sizeof m->mad;
 	m->sge.lkey = cm_id_priv->av.port->mr->lkey;
 
-	m->send_wr.wr_id = (unsigned long) msg;
+	m->send_wr.wr_id = (unsigned long) m;
 	m->send_wr.sg_list = &m->sge;
 	m->send_wr.num_sge = 1;
 	m->send_wr.opcode = IB_WR_SEND;



More information about the general mailing list