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 3E9BAC4332F for ; Tue, 18 Oct 2022 08:40:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D66496B0075; Tue, 18 Oct 2022 04:40:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D16E76B0078; Tue, 18 Oct 2022 04:40:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BDE766B007B; Tue, 18 Oct 2022 04:40:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id B085F6B0075 for ; Tue, 18 Oct 2022 04:40:01 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 81B8680403 for ; Tue, 18 Oct 2022 08:40:01 +0000 (UTC) X-FDA: 80033422602.17.EAF3BFE Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) by imf21.hostedemail.com (Postfix) with ESMTP id 184A31C002A for ; Tue, 18 Oct 2022 08:40:00 +0000 (UTC) Received: by mail-ed1-f42.google.com with SMTP id r14so19423601edc.7 for ; Tue, 18 Oct 2022 01:40:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Bk3gcbpb6ZYdoK0dmBi4jOV1xqzE9DhnWLfW4dnfw1o=; b=bSckSaTpoDSYDnZKmrDGPhCnNoj7QmeLYurYpyqW/6AOT38+tutsL61JoVA1qAgC0R 9RELEFzEPRkv5++j+WqaqPJjgS1OIT7fKLEIJI86snUsL04wlj/16nrzEZaCqfLKL+0K tl16JtlbvKcfnrPnppzAt2DpYWxzzakTLBOexPba+jG3jIf62KZnlMCDX6oG67LKNrEO UpY5O909xFk/eJgzqQ+9rURKUoiUhZEmmy2ITxIS8ZnvnE+J8fbNimgclFIVwOHHHUyN WPbiiC2sS4VxQqzSCPnGED/bqHy0HUmDNqK+ZXdqzDU4ZyTTPZiy9JDRN1nZkJEDLjls Vo7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Bk3gcbpb6ZYdoK0dmBi4jOV1xqzE9DhnWLfW4dnfw1o=; b=3FI115D+7iuUE/Txg9Ruf2gGQY/qD0Cc3i1bN0knqlXzkdEnIL+CxDne0zGsVb7eu2 HdhUR846mgZ3ZX9Jbss7o+vN0TAph46503QzEV4sR8n81X+sDXAHf4ef5BQHiRNAF+YA mx7uk/2UMwEkZzZ7GLr4IM65/pJ22E4AkJDo8OhkxgkV+qsw3fLtZGZc6eSvTgjNEVwA Q5zSx7dqzFQQU6bxjKJDKQ13KkffRYWLIar5bRuS2TUA45AexOcDkBFDeSHIuj1yXSzw J5Pq8AP5S4f9EYO1sPkHtLq95FQ3SVBtnoPJXx2iDPDMCcPJCKOZlXuhNeEVLJxPD+KP ipFw== X-Gm-Message-State: ACrzQf1meFNe3Kvl3YyVnXvMJXR4HBnb0tOKV++Gt97TCIGzQhGzyVaO KfhdTnTX8XPaX6hdwqWZEmyuNnsy1K1oB4IpZD8= X-Google-Smtp-Source: AMsMyM5TFQMq+6oIkQC4pJeiFkR3ENjx2BxdlwqxF+j7Pdn6PVIhM6Dsu/6Z3Fc7NqyONQQt4tF1oifJsx8m1bPhmUA= X-Received: by 2002:a05:6402:11c9:b0:45d:aa9b:5193 with SMTP id j9-20020a05640211c900b0045daa9b5193mr1599459edw.372.1666082399690; Tue, 18 Oct 2022 01:39:59 -0700 (PDT) MIME-Version: 1.0 References: <202210181318.WUNV3QRv-lkp@intel.com> In-Reply-To: From: Dongliang Mu Date: Tue, 18 Oct 2022 16:37:57 +0800 Message-ID: Subject: Re: [linux-next:master 1304/1443] fs/jfs/jfs_dmap.c:196:23: warning: result of comparison of constant 8796093022201 with expression of type 'int' is always false To: kernel test robot Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org, Linux Memory Management List , Dave Kleikamp Content-Type: text/plain; charset="UTF-8" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666082401; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Bk3gcbpb6ZYdoK0dmBi4jOV1xqzE9DhnWLfW4dnfw1o=; b=BFH6VKNLQv19XjqCz+pjhJwycBfuZdTgtWAat6oPMI5rXsc11TwjfEVFFs2s2Uumu9uMXG hLWVm9MFcDJDFWb6LcTlwap93XbuQjh5MAjW8vvrmLeMqhUFIaey1JWqMqMeCMe5yLsAdd kBl1inwm1SufCCA7X7kZpxl8LaMYh2A= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=bSckSaTp; spf=pass (imf21.hostedemail.com: domain of mudongliangabcd@gmail.com designates 209.85.208.42 as permitted sender) smtp.mailfrom=mudongliangabcd@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666082401; a=rsa-sha256; cv=none; b=WIKe/QoOerBJRBP8nzZcXG5xV1r+XRhfrB9p1t2gD4tMzagZXa6zwpwqa1yVTR+7oidB6I EvUMXjmLtdVjKvuaQfDP8qX4/PQm6SVbSPMs2FIfNkJ/P0uFgtwRpC+u/Fjn0HTcg2MP9x HpOHht1COUvV/D0Vki/0ATHccuz5neU= X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 184A31C002A X-Rspam-User: Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=bSckSaTp; spf=pass (imf21.hostedemail.com: domain of mudongliangabcd@gmail.com designates 209.85.208.42 as permitted sender) smtp.mailfrom=mudongliangabcd@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Stat-Signature: cqxcu4ihw83qark8dg17togfzp63sw5i X-HE-Tag: 1666082400-130847 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 Tue, Oct 18, 2022 at 4:11 PM Dongliang Mu wrote: > > On Tue, Oct 18, 2022 at 1:50 PM kernel test robot wrote: > > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > > head: 4ca786ae6681b90b0ec3f4c55c89d12f835f8944 > > commit: 920f4b7e923b35fd9d117fd3cb616b310cd41010 [1304/1443] fs: jfs: fix shift-out-of-bounds in dbAllocAG > > config: mips-randconfig-r005-20221017 > > compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 791a7ae1ba3efd6bca96338e10ffde557ba83920) > > reproduce (this is a W=1 build): > > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > > chmod +x ~/bin/make.cross > > # install mips cross compiling tool for clang build > > # apt-get install binutils-mipsel-linux-gnu > > # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=920f4b7e923b35fd9d117fd3cb616b310cd41010 > > git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git > > git fetch --no-tags linux-next master > > git checkout 920f4b7e923b35fd9d117fd3cb616b310cd41010 > > # save the config file > > mkdir build_dir && cp config build_dir/.config > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash fs/jfs/ > > > > If you fix the issue, kindly add following tag where applicable > > | Reported-by: kernel test robot > > > > All warnings (new ones prefixed by >>): > > > > >> fs/jfs/jfs_dmap.c:196:23: warning: result of comparison of constant 8796093022201 with expression of type 'int' is always false [-Wtautological-constant-out-of-range-compare] > > if (bmp->db_agl2size > MAXMAPSIZE - L2MAXAG) { > > ~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~ > > 1 warning generated. > > Hi Dave, > > I did not double check the upper bound of db_agl2size. It seems the > upper bound should be L2MAXL2SIZE - L2MAXAG, other than MAXMAPSIZE - > L2MAXAG. > > And L2MAXL2SIZE = L2BPERDMAP + 3 * L2LPERCTL = 13+3*10 = 43. > > I will send a fixes commit. The fixes patch is here: https://marc.info/?l=jfs-discussion&m=166608184908883&w=2 > > > > > > > vim +/int +196 fs/jfs/jfs_dmap.c > > > > 135 > > 136 /* > > 137 * NAME: dbMount() > > 138 * > > 139 * FUNCTION: initializate the block allocation map. > > 140 * > > 141 * memory is allocated for the in-core bmap descriptor and > > 142 * the in-core descriptor is initialized from disk. > > 143 * > > 144 * PARAMETERS: > > 145 * ipbmap - pointer to in-core inode for the block map. > > 146 * > > 147 * RETURN VALUES: > > 148 * 0 - success > > 149 * -ENOMEM - insufficient memory > > 150 * -EIO - i/o error > > 151 * -EINVAL - wrong bmap data > > 152 */ > > 153 int dbMount(struct inode *ipbmap) > > 154 { > > 155 struct bmap *bmp; > > 156 struct dbmap_disk *dbmp_le; > > 157 struct metapage *mp; > > 158 int i, err; > > 159 > > 160 /* > > 161 * allocate/initialize the in-memory bmap descriptor > > 162 */ > > 163 /* allocate memory for the in-memory bmap descriptor */ > > 164 bmp = kmalloc(sizeof(struct bmap), GFP_KERNEL); > > 165 if (bmp == NULL) > > 166 return -ENOMEM; > > 167 > > 168 /* read the on-disk bmap descriptor. */ > > 169 mp = read_metapage(ipbmap, > > 170 BMAPBLKNO << JFS_SBI(ipbmap->i_sb)->l2nbperpage, > > 171 PSIZE, 0); > > 172 if (mp == NULL) { > > 173 err = -EIO; > > 174 goto err_kfree_bmp; > > 175 } > > 176 > > 177 /* copy the on-disk bmap descriptor to its in-memory version. */ > > 178 dbmp_le = (struct dbmap_disk *) mp->data; > > 179 bmp->db_mapsize = le64_to_cpu(dbmp_le->dn_mapsize); > > 180 bmp->db_nfree = le64_to_cpu(dbmp_le->dn_nfree); > > 181 bmp->db_l2nbperpage = le32_to_cpu(dbmp_le->dn_l2nbperpage); > > 182 bmp->db_numag = le32_to_cpu(dbmp_le->dn_numag); > > 183 if (!bmp->db_numag) { > > 184 err = -EINVAL; > > 185 goto err_release_metapage; > > 186 } > > 187 > > 188 bmp->db_maxlevel = le32_to_cpu(dbmp_le->dn_maxlevel); > > 189 bmp->db_maxag = le32_to_cpu(dbmp_le->dn_maxag); > > 190 bmp->db_agpref = le32_to_cpu(dbmp_le->dn_agpref); > > 191 bmp->db_aglevel = le32_to_cpu(dbmp_le->dn_aglevel); > > 192 bmp->db_agheight = le32_to_cpu(dbmp_le->dn_agheight); > > 193 bmp->db_agwidth = le32_to_cpu(dbmp_le->dn_agwidth); > > 194 bmp->db_agstart = le32_to_cpu(dbmp_le->dn_agstart); > > 195 bmp->db_agl2size = le32_to_cpu(dbmp_le->dn_agl2size); > > > 196 if (bmp->db_agl2size > MAXMAPSIZE - L2MAXAG) { > > 197 err = -EINVAL; > > 198 goto err_release_metapage; > > 199 } > > 200 > > 201 for (i = 0; i < MAXAG; i++) > > 202 bmp->db_agfree[i] = le64_to_cpu(dbmp_le->dn_agfree[i]); > > 203 bmp->db_agsize = le64_to_cpu(dbmp_le->dn_agsize); > > 204 bmp->db_maxfreebud = dbmp_le->dn_maxfreebud; > > 205 > > 206 /* release the buffer. */ > > 207 release_metapage(mp); > > 208 > > 209 /* bind the bmap inode and the bmap descriptor to each other. */ > > 210 bmp->db_ipbmap = ipbmap; > > 211 JFS_SBI(ipbmap->i_sb)->bmap = bmp; > > 212 > > 213 memset(bmp->db_active, 0, sizeof(bmp->db_active)); > > 214 > > 215 /* > > 216 * allocate/initialize the bmap lock > > 217 */ > > 218 BMAP_LOCK_INIT(bmp); > > 219 > > 220 return (0); > > 221 > > 222 err_release_metapage: > > 223 release_metapage(mp); > > 224 err_kfree_bmp: > > 225 kfree(bmp); > > 226 return err; > > 227 } > > 228 > > > > -- > > 0-DAY CI Kernel Test Service > > https://01.org/lkp