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] [day] [month] [year] [list]
Message-ID: <20071205114150.GA13654@atrey.karlin.mff.cuni.cz>
Date:	Wed, 5 Dec 2007 12:41:50 +0100
From:	Jan Kara <jack@...e.cz>
To:	Daniel Drake <dsd@...too.org>
Cc:	linux-kernel@...r.kernel.org, avuton@...il.com, hancockr@...w.ca,
	alan@...rguk.ukuu.org.uk, andi@...stfloor.org, mrmacman_g4@....com,
	dean@...tic.org, argggh@...phinics.no, jengelh@...putergmbh.de,
	shdl@...alwe.fi, vlobanov@...akeasy.net, drzeus-list@...eus.cx,
	strange@....no-ip.org, dm.n9107@...il.com,
	johannes@...solutions.net
Subject: Re: [RFC v2] Documentation about unaligned memory access

  A minor typo:

... 
> Avoiding unaligned accesses
> ===========================
> 
> The easiest way to avoid unaligned access is to use the get_unaligned() and
> put_unaligned() macros provided by the <asm/unaligned.h> header file.
> 
> Going back to an earlier example of code that potentially causes unaligned
> access:
> 
> 	void myfunc(u8 *data, u32 value)
> 	{
> 		[...]
> 		*((u32 *) data) = cpu_to_le32(value);
> 		[...]
> 	}
> 
> To avoid the unaligned memory access, you would rewrite it as follows:
> 
> 	void myfunc(u8 *data, u32 value)
> 	{
> 		[...]
> 		value = cpu_to_le32(value);
> 		put_unaligned(value, data);
> 		[...]
> 	}
> 
> The get_unaligned() macro works similarly. Assuming 'data' is a pointer to
> memory and you wish to avoid unaligned access, its usage is as follows:
> 
> 	u32 value = get_unaligned(data);
> 
> These macros work work for memory accesses of any length (not just 32 bits as
               ^^^^^^^^^
remove one of them :)

									Honza
-- 
Jan Kara <jack@...e.cz>
SuSE CR Labs
--
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