lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1211330880.5915.236.camel@brick>
Date:	Tue, 20 May 2008 17:48:00 -0700
From:	Harvey Harrison <harvey.harrison@...il.com>
To:	Al Viro <viro@...IV.linux.org.uk>
Cc:	jgarzik@...ox.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] misc drivers/net endianness noise

On Wed, 2008-05-21 at 01:34 +0100, Al Viro wrote:
> Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
> ---
>  	tx_buf = catc->tx_buf[catc->tx_idx] + catc->tx_ptr;
> -	*((u16*)tx_buf) = (catc->is_f5u011) ? cpu_to_be16((u16)skb->len) : cpu_to_le16((u16)skb->len);
> +	if (catc->is_f5u011)
> +		*(__be16 *)tx_buf = cpu_to_be16(skb->len);
> +	else
> +		*(__le16 *)tx_buf = cpu_to_le16(skb->len);
>  	skb_copy_from_linear_data(skb, tx_buf + 2, skb->len);

I was contemplating an api like:

void put_le16(u16 val, __le16 *ptr)
{
	*ptr = cpu_to_le16(val);
}

which would allow the above to become:

	if (catc->is_f5u011)
		put_be16(skb->len, tx_buf);
	else
		put_le16(skb->len, tx_buf);

Thoughts?

Harvey

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ