From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-111.freemail.mail.aliyun.com (out30-111.freemail.mail.aliyun.com [115.124.30.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 632B43126D0 for ; Wed, 15 Apr 2026 02:27:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.111 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776220073; cv=none; b=tdZsJ/kW8fY6wKETTkNwMiHYW+YH7TlrGeyn/a61c001BmYfVEu/4zYzHWRfGiA772jcTUiDRjiRAtzkd6AG+l8ZxaLWLC4JLywPuMk2Gy9y1Sk6jYYjzUfKhm2eDt5Aw3xfcVzYNiVJp/sOftpxT6QgItHHQPlGfT6+s2tjlpU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776220073; c=relaxed/simple; bh=N0WeQveJSe36O4vzZHunawK5MFpbamPyzqsz9jaS4vw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=iFxC5qXmBLwQK/FLYEflucFGW54MuzThCgMRRr1jQlKhmBz0b7qYYMzbA8dIKO8fnL3c3y03WE5Efvne4GJT995MFMsh5rL0M71bf3rd3bJtDOYfl+EC/CooRixqRf5T+gge7uxQJ6CSmN+ZXKlHv57iagScmPcQ5SxhAsH/RdE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=LNCkSAgn; arc=none smtp.client-ip=115.124.30.111 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="LNCkSAgn" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1776220068; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=UGv9x1boX8h/Deb8a8+F3ObyeaQMEQe0PQ12CK07I5Q=; b=LNCkSAgnxiBS7u9YOF1+tV3ijpN1YA6sxPDTMkvjYHpe2YrPleEuxnlUNr2c3o4bPES9SSDMdmXHJywvUuKoZRYmIUHPmLOepOTcyCC/NLRO4hU9e9veOKGg40SmYaqvuU+yPvf/aE7V92un0F9ySygdNhpFNFS9QIFeCdH/ReI= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R491e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037033178;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=19;SR=0;TI=SMTPD_---0X12xEIY_1776220065; Received: from 30.74.144.121(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0X12xEIY_1776220065 cluster:ay36) by smtp.aliyun-inc.com; Wed, 15 Apr 2026 10:27:46 +0800 Message-ID: <7d5bc512-f3ed-40dc-991d-70cfed32b6f7@linux.alibaba.com> Date: Wed, 15 Apr 2026 10:27:45 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] [v2] mm/vmscan: avoid false-positive -Wuninitialized warning To: Arnd Bergmann , Andrew Morton , Johannes Weiner Cc: Arnd Bergmann , Kairui Song , Qi Zheng , Shakeel Butt , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , David Hildenbrand , Michal Hocko , Lorenzo Stoakes , Muchun Song , Davidlohr Bueso , Koichiro Den , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20260414065206.3236176-1-arnd@kernel.org> From: Baolin Wang In-Reply-To: <20260414065206.3236176-1-arnd@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 4/14/26 2:51 PM, Arnd Bergmann wrote: > From: Arnd Bergmann > > When the -fsanitize=bounds sanitizer is enabled, gcc-16 sometimes runs > into a corner case in the read_ctrl_pos() pos function, where it sees > possible undefined behavior from the 'tier' index overflowing, presumably > in the case that this was called with a negative tier: > > In function 'get_tier_idx', > inlined from 'isolate_folios' at mm/vmscan.c:4671:14: > mm/vmscan.c: In function 'isolate_folios': > mm/vmscan.c:4645:29: error: 'pv.refaulted' is used uninitialized [-Werror=uninitialized] > > Part of the problem seems to be that read_ctrl_pos() has unusual calling > conventions since commit 37a260870f2c ("mm/mglru: rework type selection") > where passing MAX_NR_TIERS makes it accumulate all tiers but passing a > smaller positive number makes it read a single tier instead. > > Shut up the warning by adding a fake initialization to the two instances > of this variable that can run into that corner case. > > Link: https://lore.kernel.org/all/CAJHvVcjtFW86o5FoQC8MMEXCHAC0FviggaQsd5EmiCHP+1fBpg@mail.gmail.com/ > Signed-off-by: Arnd Bergmann > --- > v2: replace the earlier more invasive cleanup with a trivial > workaround > --- LGTM. Reviewed-by: Baolin Wang