send_buf->mad_agent = mad_agent; 
mad_send_wr->send_buf.mad_agent = mad_agent; 
struct ib_mad_send_buf * ib_create_send_mad(struct ib_mad_agent *mad_agent,					    u32 remote_qpn, u16 pkey_index,					    struct ib_ah *ah, int rmpp_active,					    int hdr_len, int data_len,					    gfp_t gfp_mask){	struct ib_mad_agent_private *mad_agent_priv;	struct ib_mad_send_buf *send_buf;	int buf_size;	void *buf;	mad_agent_priv = container_of(mad_agent,				      struct ib_mad_agent_private, agent);	buf_size = get_buf_length(hdr_len, data_len);	if ((!mad_agent->rmpp_version &&	     (rmpp_active || buf_size > sizeof(struct ib_mad))) ||	    (!rmpp_active && buf_size > sizeof(struct ib_mad)))		return ERR_PTR(-EINVAL);	buf = kmalloc(sizeof *send_buf + buf_size, gfp_mask);	if (!buf)		return ERR_PTR(-ENOMEM);	memset(buf, 0, sizeof *send_buf + buf_size);	send_buf = buf + buf_size;	send_buf->mad = buf;	send_buf->sge.addr = dma_map_single(mad_agent->device->dma_device,					    buf, buf_size, DMA_TO_DEVICE);	pci_unmap_addr_set(send_buf, mapping, send_buf->sge.addr);	send_buf->sge.length = buf_size;	send_buf->sge.lkey = mad_agent->mr->lkey;	send_buf->send_wr.wr_id = (unsigned long) send_buf;	send_buf->send_wr.sg_list = &send_buf->sge;	send_buf->send_wr.num_sge = 1;	send_buf->send_wr.opcode = IB_WR_SEND;	send_buf->send_wr.send_flags = IB_SEND_SIGNALED;	send_buf->send_wr.wr.ud.ah = ah;	send_buf->send_wr.wr.ud.mad_hdr = &send_buf->mad->mad_hdr;	send_buf->send_wr.wr.ud.remote_qpn = remote_qpn;	send_buf->send_wr.wr.ud.remote_qkey = IB_QP_SET_QKEY;	send_buf->send_wr.wr.ud.pkey_index = pkey_index;	if (rmpp_active) {		struct ib_rmpp_mad *rmpp_mad;		rmpp_mad = (struct ib_rmpp_mad *)send_buf->mad;		rmpp_mad->rmpp_hdr.paylen_newwin = cpu_to_be32(hdr_len -			offsetof(struct ib_rmpp_mad, data) + data_len);		rmpp_mad->rmpp_hdr.rmpp_version = mad_agent->rmpp_version;		rmpp_mad->rmpp_hdr.rmpp_type = IB_MGMT_RMPP_TYPE_DATA;		ib_set_rmpp_flags(&rmpp_mad->rmpp_hdr,				  IB_MGMT_RMPP_FLAG_ACTIVE);	}	send_buf->mad_agent = mad_agent;	atomic_inc(&mad_agent_priv->refcount);	return send_buf;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/34816ad98efe4d47ffd858a0345321f9d85d9420/mad.c/buggy/drivers/infiniband/core/mad.c