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]
Date:	Mon, 04 Apr 2016 15:57:46 -0400 (EDT)
From:	David Miller <davem@...emloft.net>
To:	shamir.rabinovitch@...cle.com
Cc:	rds-devel@....oracle.com, netdev@...r.kernel.org
Subject: Re: [PATCH v3 1/2] RDS: fix "Kernel unaligned access" on sparc64

From: Shamir Rabinovitch <shamir.rabinovitch@...cle.com>
Date: Sun,  3 Apr 2016 08:24:03 -0400

> @@ -135,8 +135,9 @@ int rds_page_remainder_alloc(struct scatterlist *scat, unsigned long bytes,
>  			if (rem->r_offset != 0)
>  				rds_stats_inc(s_page_remainder_hit);
>  
> -			rem->r_offset += bytes;
> -			if (rem->r_offset == PAGE_SIZE) {
> +			/* fix 'Kernel unaligned access' on sparc64 */
> +			rem->r_offset += ALIGN(bytes, 8);
> +			if (rem->r_offset >= PAGE_SIZE) {

It is inappropriate to mark things with a comment like this in code
that has nothing at all to do what a specific architecture.

64-bit alignment, and this requirement, is also not sparc64 specific.
Other architectures have the same issue.

Next, comments should aide in the understanding of what the code is
trying to accomplish, when necessary.  So, something more appropriate
would be:

	/* Objects in this memory can countain 64-bit integers, align
	 * in order to accomodate that.
	 */

But it's very close to obvious here what the code is doing, and why
it might be doing so.

So I'd so no comment at all works best here.

I'm sorry, but it's a real pet peeve of mine when people mention
totally irrelevant crap in code comments.  What the heck does sparc64
have to do with aligning memory properly for the data types you will
be storing in that memory?!?!


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ