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 9D404C4332F for ; Tue, 18 Oct 2022 08:13:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DC9176B0072; Tue, 18 Oct 2022 04:13:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D78E06B0075; Tue, 18 Oct 2022 04:13:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C407A6B0078; Tue, 18 Oct 2022 04:13:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id AEEE36B0072 for ; Tue, 18 Oct 2022 04:13:13 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 7CCEE120EC9 for ; Tue, 18 Oct 2022 08:13:13 +0000 (UTC) X-FDA: 80033355066.12.56084B2 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) by imf01.hostedemail.com (Postfix) with ESMTP id 0974D40047 for ; Tue, 18 Oct 2022 08:13:12 +0000 (UTC) Received: by mail-ej1-f50.google.com with SMTP id 13so30359816ejn.3 for ; Tue, 18 Oct 2022 01:13:12 -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=Fg0IvBvRc/jWKoscgmv8LC7T7fuhyAMOnCOCCTW5TsM=; b=ezrJf0RfI2HtJjEOXT4vDbWHA7yh2Yc8eSv3LTUoq6q3I5esKSps5dXV7Q/vEKeVWz 60pO3XMXlGI1qgNy5LzDTCiDm1b09K24N5jONKTDyxcVZ1lpIwE6vmltl6X7A55XQk+O kqWHbf8gUPZfEgrqeAorW5lEuJRAxKZqXJ4J4psHAygpjwCd1pejMVQmTunVtKjGhlMV xvDA0dToF9jGA53sg95KpWNv0LYgz2/3k7PsXth/PMNDGyDcSQh+6rk3XEb4wzIu9pax SqsoHfKM23hNui4lB8eOIgNLXjt4PHTJO8FZSb528bqfHcK9++3fPXJCXLXYSiGJtOPO B2Dw== 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=Fg0IvBvRc/jWKoscgmv8LC7T7fuhyAMOnCOCCTW5TsM=; b=0O5w6wB2Fsw6zc3pnT/KpAZOB0bpKm8aMEjYUtyMj27ibAwPADzitraUHHAXwATPHJ B4smMKCX8u6033oGXnPDlI+UnTTtzwW26O65BxEqrC6Vads5ssESJfgaZ7i1PnnzFA21 07q3UslmU767mX+gH/54ELSw3H3CeEJT/0OSKuIhxva2o6HGZ9KswbRjLERF12x9Hkw9 x0l3+bAtnotzMuDYDh0NN12Z0utPGxX6SsARROo+nZwOwHsPE678JlT/d85R29woFh0z UG1G1cO7xiOWJ6mHoMxMdTEEnqeV+Ypsyf4MDgwcArx/aRhjAKZ+ICzDhZ4xEaPBlqP6 odAg== X-Gm-Message-State: ACrzQf3BJ24FJXwxCMDjzWxVdp6y+SMm6MX5QOVxRZok6BvgA2Bej8uY KMfPvxSyVUOLEvTuQu4CRqx/dTGCGLg/ecdbIdI= X-Google-Smtp-Source: AMsMyM67Kc69Fsq4B4x4cUbiU+DBeqUy8a6ZNRx5F555H7x4SrGvXm2a9EMeJ16soNabymYYAMRSpR9SSYEQK2rpXuU= X-Received: by 2002:a17:907:16a5:b0:78d:e608:f073 with SMTP id hc37-20020a17090716a500b0078de608f073mr1408077ejc.753.1666080791544; Tue, 18 Oct 2022 01:13:11 -0700 (PDT) MIME-Version: 1.0 References: <202210181318.WUNV3QRv-lkp@intel.com> In-Reply-To: <202210181318.WUNV3QRv-lkp@intel.com> From: Dongliang Mu Date: Tue, 18 Oct 2022 16:11:08 +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-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ezrJf0Rf; spf=pass (imf01.hostedemail.com: domain of mudongliangabcd@gmail.com designates 209.85.218.50 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=1666080793; a=rsa-sha256; cv=none; b=4ahhBFAXRmp6OHqyjXaxNVU3NHD0o0V9bUe+CfS8cpsy5aMBeiHBSKwe3GUCXI+FZy9uqt PV2Lb9v1xHhp/zsYscLVGMSesJsHZ8enqDtj3ASvJoQgme2KllD3XBwZZ53ysOYWPYjXj9 I09gEmAlQ33PMmOjb4y2vEtxc1PZADY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666080793; 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=Fg0IvBvRc/jWKoscgmv8LC7T7fuhyAMOnCOCCTW5TsM=; b=rL5ZUyhPIvPVL1CCAPhsPz4B8ClRnj8/9Un35oCNhsMtDmWr1aQU9X7Tv5cqgMK9Yl4Jto HzkhlHDLmq3a12uzMZ9TdN/i10q2lmLE6ExC2Z8mxnwCUVYN87MNFTn5SrqE+blzxLiHS6 /vMSqzOV0hcBBGJWCuwFz4YYfCxm8uU= X-Stat-Signature: 7tunksxxt7xu7zngnk1qrm9ukc4jx6r6 X-Rspamd-Queue-Id: 0974D40047 Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ezrJf0Rf; spf=pass (imf01.hostedemail.com: domain of mudongliangabcd@gmail.com designates 209.85.218.50 as permitted sender) smtp.mailfrom=mudongliangabcd@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1666080792-956625 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 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. > > > 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