From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18FE7C433F5 for ; Mon, 14 Mar 2022 13:37:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7269A6B0072; Mon, 14 Mar 2022 09:37:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6AF176B0073; Mon, 14 Mar 2022 09:37:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 550C18D0001; Mon, 14 Mar 2022 09:37:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 3F8B56B0072 for ; Mon, 14 Mar 2022 09:37:02 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 0BD9821EFD for ; Mon, 14 Mar 2022 13:37:02 +0000 (UTC) X-FDA: 79243092684.08.A67B82B Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf12.hostedemail.com (Postfix) with ESMTP id 2416740031 for ; Mon, 14 Mar 2022 13:37:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=iXcu0zpNomi+egHrk8uM8X+vTe8iTkgUld8/hn8ib7g=; b=ez4ABvKWO3QcDNAIpwwVHQ7+rE TfWzdoOq5BsgyWgPh6zeSuUCRy/U8+32BHoHnY8Ed3wkzyMkzTC3+QMNgkjqIjqPvAbkZZS2tq2oY mPQ1+1lEo3wQv+LjhgR/Kyv4n19upbe0VtYur5uMz+ktML6vqTVpExr8EAxRjRK6WzY7mMXLgKkbY 4qMArV0wKlqgEeE0pcNRajNnT4qq39GZPPrHz0kfzGuVeLl1T+J9DFH/PgMhfkVR3ut5mLC4m3Bge NvnXIyHFygsdOHQuw2i+hoDhUsu5shCVOb6N1QsfKOO8ToAORjaJtG8kXdEgtL3xpuYGFZT3ENzuZ jZE3LImA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nTksV-0045Pt-E7; Mon, 14 Mar 2022 13:36:51 +0000 Date: Mon, 14 Mar 2022 13:36:51 +0000 From: Matthew Wilcox To: Dan Carpenter Cc: kernel test robot , kbuild-all@lists.01.org, Linux Memory Management List Subject: Re: [linux-next:master 9762/11953] mm/page_vma_mapped.c:246 page_vma_mapped_walk() warn: always true condition '(pvmw->nr_pages >= (1 << ( - (12)))) => (0-u64max >= 0)' Message-ID: References: <202203131056.WINF40Gt-lkp@intel.com> <20220314133038.GS3315@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220314133038.GS3315@kadam> X-Stat-Signature: mtgjqm3ebu7ud9kcn1jtkpcw49nxt3kr Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ez4ABvKW; spf=none (imf12.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 2416740031 X-HE-Tag: 1647265021-394380 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: On Mon, Mar 14, 2022 at 04:30:38PM +0300, Dan Carpenter wrote: > On Sun, Mar 13, 2022 at 04:06:37AM +0000, Matthew Wilcox wrote: > > On Sun, Mar 13, 2022 at 11:01:09AM +0800, kernel test robot wrote: > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > > > head: 71941773e143369a73c9c4a3b62fbb60736a1182 > > > commit: b786e44a4dbfe64476e7120ec7990b89a37be37d [9762/11953] mm: Convert page_vma_mapped_walk to work on PFNs > > > config: riscv-randconfig-m031-20220312 (https://download.01.org/0day-ci/archive/20220313/202203131056.WINF40Gt-lkp@intel.com/config ) > > > compiler: riscv64-linux-gcc (GCC) 11.2.0 > > > > > > If you fix the issue, kindly add following tag as appropriate > > > Reported-by: kernel test robot > > > > > > smatch warnings: > > > mm/page_vma_mapped.c:246 page_vma_mapped_walk() warn: always true condition '(pvmw->nr_pages >= (1 << ( - (12)))) => (0-u64max >= 0)' > > > > Looks like a duplicate of https://lore.kernel.org/lkml/YgpzPru8aFA5sHOI@casper.infradead.org/ > > > > Dan, any thoughts? Do you consider this a false positive from smatch? > > > > That's really weird that HPAGE_PMD_NR ends up as zero... Does it wrap > to zero? It's actually weirder than that: #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; }) #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT) #define HPAGE_PMD_NR (1< Anyway, it would be easy to silence the warning based on that it's on an > impossible path but I think that's not the right idea. > > if (is_impossible_path()) > return; > > A lot of the bugs that Smatch finds are in impossible to reach error > handling code. I'll instead silence it based on that the macro > definition changes. Add it to smatch_data/kernel.unconstant_macros: > > > - if (!possibly_false_rl(rl_left, expr->op, rl_right)) { > + if (!possibly_false_rl(rl_left, expr->op, rl_right) && > + !is_unconstant_macro(expr->left) && > + !is_unconstant_macro(expr->right)) { > char *name = expr_to_str(expr); > > sm_warning("always true condition '(%s) => (%s %s %s)'", name, > > I'll test this out overnight, tonight. Thanks! I'd be happy to rearrange this code to avoid the smatch report, but it's not quite clear to me how I could/should do that.