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, 8 Feb 2008 14:04:55 -0800 (PST)
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Andrew Morton <akpm@...ux-foundation.org>
cc:	Harvey Harrison <harvey.harrison@...il.com>,
	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, 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.

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());

instead.

The above is totally untested, of course.

		Linus
--
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