Search Linux Wireless

Re: : Emit event stream compat iw_point objects correctly.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



	Hi

On Fri, 21 Dec 2007 20:58:08 -0800 (PST)
David Miller <davem@xxxxxxxxxxxxx> wrote:

> @@ -520,7 +530,7 @@ iwe_stream_add_point(char *	stream,		/* Stream of events */
>  		memcpy(stream + IW_EV_LCP_LEN,
>  		       ((char *) iwe) + IW_EV_LCP_LEN + IW_EV_POINT_OFF,
>  		       IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN);

As the alignment of 64bit platforms may be defferent from 32bit one,
should it be like the following?

static inline char *
iwe_stream_add_point(char *	stream,		/* Stream of events */
		     char *	ends,		/* End of stream */
		     struct iw_event *iwe,	/* Payload length + flags */
		     char *	extra,		/* More payload */
		     struct iw_request_info *info)
{
	int	event_len = IW_EV_POINT_LEN + iwe->u.data.length;
	int	point_len = IW_EV_POINT_LEN;
	int	lcp_len = IW_EV_LCP_LEN;

#ifdef CONFIG_COMPAT
	if (info->flags & IW_REQUEST_FLAG_COMPAT) {
		event_len = IW_EV_COMPAT_POINT_LEN + iwe->u.data.length;
		point_len = IW_EV_COMPAT_POINT_LEN;
		lcp_len = IW_EV_COMPAT_LCP_LEN;
	}
#endif

	/* Check if it's possible */
	if(likely((stream + event_len) < ends)) {
		iwe->len = event_len;
		memcpy(stream, (char *) iwe, IW_EV_LCP_PK_LEN);
		memcpy(stream + lcp_len,
		       ((char *) iwe) + IW_EV_LCP_LEN + IW_EV_POINT_OFF,
		       IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN);
		memcpy(stream + point_len, extra, iwe->u.data.length);
		stream += event_len;
	}
	return stream;
}

(Note that IW_EV_COMPAT_LCP_LEN is just a example; not defined anywhere)

-- 
Masakazu MOKUNO

-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux