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]
Date:	Fri, 08 Feb 2008 14:17:58 -0800
From:	Harvey Harrison <harvey.harrison@...il.com>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	Andrew Morton <akpm@...ux-foundation.org>, viro@...IV.linux.org.uk,
	linux-kernel@...r.kernel.org, mingo@...e.hu
Subject: Re: [PATCH] fix sparse warning from include/linux/mmzone.h

On Fri, 2008-02-08 at 14:04 -0800, Linus Torvalds wrote:
> 
> On Fri, 8 Feb 2008, Andrew Morton wrote:
> > >  #ifdef CONFIG_HIGHMEM
> > > -	int zone_idx = zone - zone->zone_pgdat->node_zones;
> > > -	return zone_idx == ZONE_HIGHMEM ||
> > > -		(zone_idx == ZONE_MOVABLE && zone_movable_is_highmem());
> > > +	const int highmem_off = ZONE_HIGHMEM * sizeof(*zone);
> > > +	const int movable_off = ZONE_MOVABLE * sizeof(*zone);
> > > +
> > > +	int zone_off = (unsigned long)zone - (unsigned long)zone->zone_pgdat->node_zones;
> > > +	return zone_off == highmem_off ||
> > > +		(zone_off == movable_off && zone_movable_is_highmem());
> > 
> > hrm.  For my i386 build (and that's where CONFIG_HIGHMEM really matters)
> > this patch makes mm/page_alloc.o six bytes larger, and I don't think the
> > change did much for readability.
> 
> Heh, yeah. That's a very odd way to write it.

As long as you read 'odd' as 'rather dumb'

> 
> It would probably make more sense to just write it as something like
> 
> 	struct zone *base = zone->zone_pgdat->node_zones;
> 
> 	if (zone == base + ZONE_HIGHMEM ||
> 		(zone == base + ZONE_MOVABLE && zone_movable_is_highmem());

s/if/return/ I think.  And missing a closing brace.  Unless I'm (again)
missing something.

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