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: <20160511145321.GA22776@dhcp22.suse.cz>
Date:	Wed, 11 May 2016 16:53:22 +0200
From:	Michal Hocko <mhocko@...nel.org>
To:	Arnd Bergmann <arnd@...db.de>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Mel Gorman <mgorman@...hsingularity.net>,
	Vlastimil Babka <vbabka@...e.cz>,
	David Rientjes <rientjes@...gle.com>,
	Joonsoo Kim <iamjoonsoo.kim@....com>,
	Taku Izumi <izumi.taku@...fujitsu.com>,
	Johannes Weiner <hannes@...xchg.org>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm, compaction: avoid uninitialized variable use

On Wed 11-05-16 16:44:07, Michal Hocko wrote:
> On Wed 11-05-16 15:24:44, Arnd Bergmann wrote:
> > A recent rework of the compaction code introduced a warning about
> > an uninitialized variable when CONFIG_COMPACTION is disabled and
> > __alloc_pages_direct_compact() does not set its 'compact_result'
> > output argument:
> > 
> > mm/page_alloc.c: In function '__alloc_pages_nodemask':
> > mm/page_alloc.c:3651:6: error: 'compact_result' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > 
> > This adds another check for CONFIG_COMPACTION to ensure we never
> > evaluate the uninitialized variable in this configuration, which
> > is probably the simplest way to avoid the warning.
> 
> I think that hiding this into __alloc_pages_direct_compact is a better
> idea. See the diff below
> > 
> > A more elaborate rework might make this more readable.
> > 
> > Signed-off-by: Arnd Bergmann <arnd@...db.de>
> > Fixes: 13cff7b81275 ("mm, compaction: simplify __alloc_pages_direct_compact feedback interface")
> 
> Please do not use SHA for mmotm commits because they are unstable and
> change each linux-next release.
> 
> --- 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 4950d01ff935..14e3b4d93adc 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -3300,6 +3300,7 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
>  		unsigned int alloc_flags, const struct alloc_context *ac,
>  		enum migrate_mode mode, enum compact_result *compact_result)
>  {
> +	*compact_result = COMPACT_DEFERRED;

Sorry, this should have been COMPACT_SKIPPED.

-- 
Michal Hocko
SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ