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: 10665699 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 22F9514BD for ; Fri, 2 Nov 2018 15:31:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 127B029015 for ; Fri, 2 Nov 2018 15:31:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0724E2C3B2; Fri, 2 Nov 2018 15:31:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7098629015 for ; Fri, 2 Nov 2018 15:31:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4683E6B0003; Fri, 2 Nov 2018 11:31:55 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 415206B0007; Fri, 2 Nov 2018 11:31:55 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2DE636B0008; Fri, 2 Nov 2018 11:31:55 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by kanga.kvack.org (Postfix) with ESMTP id C8E366B0003 for ; Fri, 2 Nov 2018 11:31:54 -0400 (EDT) Received: by mail-wm1-f71.google.com with SMTP id t74-v6so1071427wmt.0 for ; Fri, 02 Nov 2018 08:31:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id; bh=YvHR+IUtr/rKfBurpUIk04H4wDcnoPsZgQWUSOq4epE=; b=SYZ1qvMjEyEmR3myPydkR3fYTcKFMf7y7/RWXO5zy3tsT2qYek5ZEstwVr/4K9H6dI msdn9rKfKj4YLco0xNy/coSu3vuRMRcBZK6gmuEKfDH5zX/K2jAsdXIzL3aD3V8DsClZ FaBSOfFAVisEBdgGReAxxBBB9ahlsB0efpkgLJXKvbuOGGbp2NDndewAD0U7+3QG7goG X8F2xupNBwXC/8PQEJ44y0MRPW/bjNpmun/pZ9nHQqnYy/ekalayLcXPqMjSr++7xUkg f0k33nYjWG6diA5n+dmTqkrmHOLs4iHAb/WMSSPKx0xj1XJQFgKQ/CkDB1hzc1iYlFzm sNYg== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.72.192.74 is neither permitted nor denied by best guess record for domain of arnd@arndb.de) smtp.mailfrom=arnd@arndb.de X-Gm-Message-State: AGRZ1gJSPClKtvEVf+LPDA0l8gc/7d3dCrQmqOfLEXQUdFcdjUT3gVoS FWqMzdXbYhHcBPrMEt+2LVDP+IfuP9qmUECPYpi4mp2QNhFabZK5S/1YMuc4UuG4HsLLseFd/Y8 oXiktbT/miOsi5St83HAtwSriA73/EHtErwfYD4bIv/Aie3rXgw/z4x9woeqqejA= X-Received: by 2002:adf:9ccb:: with SMTP id h11-v6mr10911077wre.322.1541172714293; Fri, 02 Nov 2018 08:31:54 -0700 (PDT) X-Google-Smtp-Source: AJdET5emyaqjgKm94DwNv74KOr8tWd1d4Nvpu4EUNFcbQ/39Iv8r1NxTqaLl1/9hMnz5HFnWi1w3 X-Received: by 2002:adf:9ccb:: with SMTP id h11-v6mr10911018wre.322.1541172713068; Fri, 02 Nov 2018 08:31:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541172713; cv=none; d=google.com; s=arc-20160816; b=g2cjqOzMXBFpwwbwQHDt6+0Kr7R5tAaRYpoQoyNiWoWQMd0rr8RvfpArXDt7e1XSyh 9oYIQ6/tmIrHru+aYG5NLHFa1I0uh9Lc9g9SCWr4L7YqOTXmUuKW8W752OkNDxrhKAKw 0yZn6sj96ugw4ExDJUp11jnK48cfT0mOUCKG3oaZV58jAQVdYIjnhXGI8d8u9XBR84kV CDs9geKvDxT4QkqRMCq67Nd/YWQmYOMJ5YYtDOO6vfv2eCGJpRLY+ihCmPA8Wh3YF80u DQjACgad3FD90b9eM2azs6hx9dF3niwv3SS9WckdF00r9pUZRY1IIsxWF1ShekvR4rkC MjHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from; bh=YvHR+IUtr/rKfBurpUIk04H4wDcnoPsZgQWUSOq4epE=; b=wvTI/cm4OH/xR4Lm4sDaTftUjV8IMT0JngRXN6jo5P3jDLQR3NVDsdqMC+SHb3OwGk nskWMEG40wgeJ7N/yTWJVG8xAQmPJLjBta3v23pSTKeSf7BpATM8fokXmfJUpGUAAxXn PxJR1tCcDypXk7Ju0+C+UafNfwpvy9g4oS4SA68gJwlf60rnaY0nO0VKeev8z0kIFQgH CZnDWgOWFEnSiFcrr49zUkcY+bN3OcY1f2R7FNCoTSGZNTDV/ggGZjUh8FgD4+sedqDT n90P2qaiSF7q5c6XGyiVZ3ZjKUJ7qFEwS0ZfpfwTDsfvafSlCHR9R/a4/JAqM5AyKFjs 38zA== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.72.192.74 is neither permitted nor denied by best guess record for domain of arnd@arndb.de) smtp.mailfrom=arnd@arndb.de Received: from mout.kundenserver.de (mout.kundenserver.de. [217.72.192.74]) by mx.google.com with ESMTPS id e8-v6si7805250wrw.379.2018.11.02.08.31.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Nov 2018 08:31:53 -0700 (PDT) Received-SPF: neutral (google.com: 217.72.192.74 is neither permitted nor denied by best guess record for domain of arnd@arndb.de) client-ip=217.72.192.74; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.72.192.74 is neither permitted nor denied by best guess record for domain of arnd@arndb.de) smtp.mailfrom=arnd@arndb.de 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-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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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,