From patchwork Fri Nov 2 15:31:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 150050 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2218226ljp; Fri, 2 Nov 2018 08:32:26 -0700 (PDT) X-Google-Smtp-Source: AJdET5d8noJJoBxtR731dpkzoGZiWLqdVCnofW6nQGzImwkiHp/LbtCKhBanmub3XKo8BfF2NbTz X-Received: by 2002:a63:fd09:: with SMTP id d9-v6mr11594651pgh.164.1541172746341; Fri, 02 Nov 2018 08:32:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541172746; cv=none; d=google.com; s=arc-20160816; b=dM006mIizHGOAblbqz1DHcGVhtZL6yb3WPBOpTzwLwJy12f0/zCGteb/56fhfFJjGK iKEt1QbFQwI8UWEwU6MtkRH0wNwOLeWl8Y9fMikoVv1RB1CAK1na6GIdJrojNwdDymC7 J2hVbkqUGMkvVRmSgrzBOTqriCLzHNMl7mOUeD9ipTR/7f0tDKNDQ6L3XKRlZ/2YG4ny c6jaLWC1Hl03nIT67gURsMPvFOjbeKfF9nCsd4taP75XahzLNsinkVOP4cf2fnI71xn0 XB2JEqpvihVxSGcj+PqY/vr0vRMzXf42gwBarOh0NSxhAkHHZHQmLyZBeHHhqraBVQsx xDog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=YvHR+IUtr/rKfBurpUIk04H4wDcnoPsZgQWUSOq4epE=; b=vx7G0wfg/r01aOTY6XAx2i0YisxQHXM1PMxtqXngO7znlsnPt32wzmsyaKLqsAN04K 0JLGNpOqD5hgoftq71e7svO5jRyqylPjqwKcxzcS+l5InKHjO4dB6w4d8w2JT3lqOFz9 f6nxm+dCyBPgLTBxBWEz0kaA8osGm/1VuJ1bhcvsnxHk7M3eadSyE55ryOExBBMYWRMF 2NRnOT3tAgglWYaw2kbh+tyLUugAnhq3DirAV1Do7ZC0REMnSSDP9h9CtCMuYsBRXMp3 1/BYouR6dG6ZXxEGvyqm2Vi98DZVxU27OSlNxtRG0keujwUOaaj12mjuP+ZetBZ6gGXm anLA== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k13-v6si22901016pgp.145.2018.11.02.08.32.25; Fri, 02 Nov 2018 08:32:26 -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 S1727648AbeKCAjv (ORCPT + 32 others); Fri, 2 Nov 2018 20:39:51 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:54213 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726049AbeKCAju (ORCPT ); Fri, 2 Nov 2018 20:39:50 -0400 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1N7zNt-1fX5B740nr-0153HK; Fri, 02 Nov 2018 16:31:43 +0100 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1N7zNt-1fX5B740nr-0153HK; Fri, 02 Nov 2018 16:31:43 +0100 From: Arnd Bergmann To: Andrew Morton , Jan Kara Cc: Arnd Bergmann , Michal Hocko , Wang Long , Matthew Wilcox , Dave Chinner , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm: fix uninitialized variable warnings Date: Fri, 2 Nov 2018 16:31:06 +0100 Message-Id: <20181102153138.1399758-1-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 X-Provags-ID: V03:K1:EqZJZNB6u/gzxKkNz+cGMuBdNt50fQBppwS5v7b4clXrKDDXYSH gGk2I9xZzl0X+UmvFC2Qk72DaA//3On/mBJP9NB/dledExJyDGOpGCI2lN70ce+d1vwiZOk z+TVo4rEde+DHeVeIerYI4ADSRGf+jEw/y2isjgtBZhAye5qQFUA9ZqSF3V3+Q8r9drEiXH J8lMVOJbJLh2q+HHT9fJg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V01:K0:gW3o6OSuNvM=:mgCbZ/k2+A3hO7hD4oXf5A WGw1bP/yBKdd7FPaE+4wqiNlgHXv9pZbJRPv9UOqeLSEfflQqiYVYgwzyJM2OSR30DbfarxdM eusUTP0jFfFedWj1XpuGQJCN4w9YbB0Y6JnDeXrCgsQJihdwn0qEVuT0DKQ059/oskhq22zIG lMkpkoepHNyf9BmscQZE8quY0b7zSrfykoUOn5OuyQKH/Fe73/dUg7wpobok8ERjj1tFfbMjX rfa84TqO1Od7hwFXWXpBKq5/suMQ0vtEgElwmivH2z9OJ5MeJ8tZ1v/La7PygegzYzHsZ8Acn 6PgyR9hgqFNffCGikQ2Ua7vlMfISI0FHYsHaNmIavvflLMvXaULFgu0U5xxjGmaz75nAaYyCM tIyrhgB/yeHAePWUy8yRCxEmv8Sy8+0mZNtwgLSJewrPb7dSZHvm2v44SCits71kVkSAGMllv 4VNg1oTKx82PdiuF0kg4KoLdUbf/4vCGJlqgvlxEQlatZt4VeccFJY4LE0M0VxQRUGY8PXUxQ jiQBMMuyQaGPeBCi+UlI5U3uk7MDfq1Xq0S5aqol8dfjRqS0AdqSDwArsKsJYk3Aq1oaz5IQS HjOQJ4DB2B8Wd9faA8Fp+rVudiwkWJUserZpNjWM2Th4SaOzqrWuv4mLiPbJ78iqXAkTQ3JS3 /ZOJZnlTzzDz6ieEAA82FOE8iAEfCDtUWiigMsT4xIdRX9Ih1DihiAL2hicF6aMMkmhy3giLc EDOEpeOfYEn8GGulaSn6A5k7tPGmo3MfDYzZs90m06GU63iZYXrT/Dm04dD0c53/CbJO54e1g qoeI0Mq Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In a rare randconfig build, I got a warning about possibly uninitialized variables: mm/page-writeback.c: In function 'balance_dirty_pages': mm/page-writeback.c:1623:16: error: 'writeback' may be used uninitialized in this function [-Werror=maybe-uninitialized] mdtc->dirty += writeback; ^~ mm/page-writeback.c:1624:4: error: 'filepages' may be used uninitialized in this function [-Werror=maybe-uninitialized] mdtc_calc_avail(mdtc, filepages, headroom); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mm/page-writeback.c:1624:4: error: 'headroom' may be used uninitialized in this function [-Werror=maybe-uninitialized] The compiler evidently fails to notice that the usage is in dead code after 'mdtc' is set to NULL when CONFIG_CGROUP_WRITEBACK is disabled. Adding an IS_ENABLED() check makes this clear to the compiler. Signed-off-by: Arnd Bergmann --- mm/page-writeback.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.18.0 diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 3f690bae6b78..f02535b7731a 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -1611,7 +1611,7 @@ static void balance_dirty_pages(struct bdi_writeback *wb, bg_thresh = gdtc->bg_thresh; } - if (mdtc) { + if (IS_ENABLED(CONFIG_CGROUP_WRITEBACK) && mdtc) { unsigned long filepages, headroom, writeback; /* @@ -1944,7 +1944,7 @@ bool wb_over_bg_thresh(struct bdi_writeback *wb) wb_calc_thresh(gdtc->wb, gdtc->bg_thresh)) return true; - if (mdtc) { + if (IS_ENABLED(CONFIG_CGROUP_WRITEBACK) && mdtc) { unsigned long filepages, headroom, writeback; mem_cgroup_wb_stats(wb, &filepages, &headroom, &mdtc->dirty,