From patchwork Wed May 11 13:24:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102360 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp224945qge; Wed, 11 May 2016 06:26:02 -0700 (PDT) X-Received: by 10.98.36.12 with SMTP id r12mr4976762pfj.86.1462973162510; Wed, 11 May 2016 06:26:02 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r9si9928960pae.39.2016.05.11.06.26.02; Wed, 11 May 2016 06:26:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932582AbcEKNZ6 (ORCPT + 29 others); Wed, 11 May 2016 09:25:58 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:52998 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932444AbcEKNZz (ORCPT ); Wed, 11 May 2016 09:25:55 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue102) with ESMTPA (Nemesis) id 0M0i6Q-1buFQB3FNO-00usxr; Wed, 11 May 2016 15:25:33 +0200 From: Arnd Bergmann To: Andrew Morton , Michal Hocko Cc: Arnd Bergmann , Mel Gorman , Vlastimil Babka , David Rientjes , Joonsoo Kim , Taku Izumi , Johannes Weiner , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm, compaction: avoid uninitialized variable use Date: Wed, 11 May 2016 15:24:44 +0200 Message-Id: <1462973126-1183468-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 X-Provags-ID: V03:K0:zaPgcw7lNYCD4AzDiEBcNa1VqFtiTFdNlZPF3wMENbQoVp9KUoy rLtTrJJC2T6o3DOMm1QXaGtHDx8I200+1dQwZrmtACv5IAE8mZRkYFsvHj2ge9vFbZhyT7+ zRWqd/OJXzFcYLtxwi6xzhza1ySU54pajRRJfyfNAhgFA7gd6dBaU1t3irvhBvxOeF3fb4o 43A17J9/4k6XUL5kwAAJg== X-UI-Out-Filterresults: notjunk:1; V01:K0:nhbVRXpUhG4=:5IZeTme6mWgsLSy5zz+ChN kWFMJHKILXEo9JcajCnUgWm68nQGEDl6C+s2BB4b3I57IkkckL/AooDPu0xgE0bn/frIHv+Hw hFkSujh0/El/Bzq82TVFX7gqZAVMCLGZHYvRbmpjEiM8MFfve01J0hgZUNPVCqtDDsvbTp0XJ 4y5AO1HxF9rQwe0Ci9xJ2vQZv+6nhUiBVdYX5HX2rwFshELxhJ9aBWa3bzv0HkUJD6f5YfkaB ZX5vNreGEA/q4/pNjsx4ws6EzJInbQxTOq5TStx7aX7n5+CbytPv0cCUVcV8UQyOeEMikCUtX JeeIZ8J3xZUmi+fod7YWUVhsaQu50fuMj/qyxvJPzhO3vUV0zAV3tRg8DGHrxxmxJ5hoIglgI cV8zRn35XBGfaI8LGzzUJqWcRyi9+DvqSbtRisBmM7NbGAklxBMrsI2jTs98XQRji8wQJMoSa ThRle13VoROye+o95oBho/zg6OScQdh2tm/Sp8628npYmbeE3Tj9cfXddKa4AqNWR1XuIk/uf LtxMClNawVNOoEtPN7DsPw/UU3CjIrEdBP3yN8sznXQX3OxweStrMETB/UciAgP5HdCStZvPM nn5R1/jNMyV4QRd8WfOyPmySjcEkdpNHObr5Gdr1goMFDDnwjiG24eEz9CKXqTnTbX+gdoa8U mr8Oxd6+l8dbhWd00Wqf08gTLEiwPc/6B3bDmhGcsRmgqc2Wx4lwQzshxYxZ2RWeYq3k= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. A more elaborate rework might make this more readable. Signed-off-by: Arnd Bergmann Fixes: 13cff7b81275 ("mm, compaction: simplify __alloc_pages_direct_compact feedback interface") --- mm/page_alloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.7.0 diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 477d9382f70d..bedadc686a22 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3640,7 +3640,8 @@ retry: goto got_pg; /* Checks for THP-specific high-order allocations */ - if (is_thp_gfp_mask(gfp_mask)) { + if (IS_ENABLED(CONFIG_COMPACTION) && + is_thp_gfp_mask(gfp_mask)) { /* * If compaction is deferred for high-order allocations, it is * because sync compaction recently failed. If this is the case