From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5BB225B311 for ; Thu, 18 Dec 2025 07:17:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766042279; cv=none; b=AGu39Hph9lTgKbhnu1JrkeTsZ+6r4RXeAcq9tE2RdLCK/kB2X2alKVhMnLyaETwsv2y6CJ/zPeFiGCB0me7O5buuBxbk6R7Iz6p/+GKr465NIiBhuWAjU+qcY3HF4ovlEUM+rV4dyfjPaclNxGgsVmbWdMFUTT24FOW7PuPJg7o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766042279; c=relaxed/simple; bh=ZG2uGVos9jKrEEh0YiSgQg9bh1K8XhAuGphKItgKMUc=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=W8l3oUUoo3A716/0QuCduzllCHatsZceYnyoVfs/byZvlopX1/w4a6afAoPhcxHxvEFMKuoSBUnAkVdRcVGnb2Nf8sMBKrPPKI/jL8/cRJpRteGBIwMsE97/CXQCEe5nSMNqmOVJnegvjKrSCAC+CMcfLoCKa0ybj+XBD1875bY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=coYYwvs4; arc=none smtp.client-ip=209.85.221.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="coYYwvs4" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-42fb6ce71c7so200131f8f.1 for ; Wed, 17 Dec 2025 23:17:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766042276; x=1766647076; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=Jf5BAcGhlQ0Lnqc8uMzINeGbDdKgDigIFHuO+3zKQo4=; b=coYYwvs4mKBot87cBUNr/DUBwiRca9fWd9iA2WrkWMGzUE3GzHlbIDIBCNr5jIUAJe Q1CrV47bPhv8yX+JS1nL1KKzJDGCn37KAqV7xdqF254ZGf3+k33G2K1NU23FdLgGVTFD Fv6Urtq3Pcsgk7AkFA7ZwcKgw9B6Mo+/FK5vmNYE2popGFWRHKRaUR5ovFtdIB/Z0HBj FcnfR1igWN0PygphcD2i/rupYgOB/35Cv5lD2dZZNKlixfnXFZvwg+a8a0h04wwNuDCj CYZhyPSViPf/BKcIRuiGD3rNKPGjLBR96nr4glZ3qqt6hiZGM1qOMXv6mOzJS6vZ8Zc4 QtUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766042276; x=1766647076; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Jf5BAcGhlQ0Lnqc8uMzINeGbDdKgDigIFHuO+3zKQo4=; b=whZ57LIUqWtawEa5qZ+xzwLdvcKD0O9Wxc8Pz+AnI1PZJ6wqfoWPUnIqWagcmPZ9AF UPGV5YUJst1MEYoUUav5JH9xWTUTGM1EZ00aLpD9xumOg6cjBUmrXB6aDaKi4y1ESEaX ekLt4syeziN5/OFTdByo3gc4HTj5uHygdl9BlVRKt/FiWsAdDJIujp6vO4SwWi14d2Lc +YOPgmmovhPldiginxPgeZ+nGHDMxeKOqGNfDbIjNbFb7Fuy7T1Zq5JVMIAnXgfrFimn dlGsR9yDqy1FctD871f6hfB7pipOSLOrFiy83AQPfkqlgK7zFJY9+xJrGhuaEPDEYkV9 PRjQ== X-Forwarded-Encrypted: i=1; AJvYcCU8452Nl0zEdXsid2rj1x4rPNyv8V7IjcjoJaks9LRn7BFMFfGsyFm36WF/hnN5XDvIZwrShNrOT0D8sxQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwIanFLrWsGV9kKF1dmUD5Oo5m4oYwRzippSLgy2JvvNk8Dm6Jg BJmb7fqLosmuEtDNwxbkbtnJdENgpJ7IRBxiJI0uW13rU7VRQ9o1ThohUlx+C8/Jxm4= X-Gm-Gg: AY/fxX7foZpopqrJW1Ymgxv5IlBT/E/SM5q3J2+UEhNTwLwJOCoB63fE/ENunZISNAl ZqE161R7huANGWwsrzz123CYTsNW0Pzyhc1TVOntt6F72hotA1yaA9KOE2rLVJgg2UtjQUXHZMy oJYETVln2gx3gbCym+Ay3sTe2w18tS2xY9fRDihdZnaekZEGSlSme2aUS/e59rLtGFEPOE53y74 Foev6MNWjlr7fZo4yZ3ec/Sa/ki1O4BVAl0fps8yAprK94SjDpuU0Skn+hYbnDVg50ygfp56AfZ sEK0ovtMBVWv4xjTxGHeAfz+oOo45CbJwfPLVVdCMw7lvU11gEHsGbY046tQNBkaVEkrwzahP6B 9oTrGvlwQo+ATWS9yQOInRTXasEhDnYIe+t0RIGrP8Tjtgb/riuHZ/T68y5znI51QHhngwk0R0z J4zdPD1dL20cx6NJFC X-Google-Smtp-Source: AGHT+IHP0/nOTUAYZJnjYxs4Ze+aKEzrPADjEBA33VeDRR8gsG0whl1HjnLrlF5DyOhSaqSl0ytkbQ== X-Received: by 2002:a05:6000:2c0d:b0:431:a16:5533 with SMTP id ffacd0b85a97d-4310a1656f6mr6517869f8f.31.1766042275841; Wed, 17 Dec 2025 23:17:55 -0800 (PST) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4324493fd73sm3294161f8f.13.2025.12.17.23.17.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Dec 2025 23:17:55 -0800 (PST) Date: Thu, 18 Dec 2025 10:17:52 +0300 From: Dan Carpenter To: oe-kbuild@lists.linux.dev, Alice Ryhl Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org, Wedson Almeida Filho , Matt Gilbride Subject: drivers/android/binder/rust_binderfs.c:134 binderfs_binder_device_create() error: Calling ida_alloc_max() with a 'max' argument which is a power of 2. -1 missing? Message-ID: <202512181203.IOv6IChH-lkp@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: ea1013c1539270e372fc99854bc6e4d94eaeff66 commit: eafedbc7c050c44744fbdf80bdf3315e860b7513 rust_binder: add Rust Binder driver config: loongarch-randconfig-r071-20251218 (https://download.01.org/0day-ci/archive/20251218/202512181203.IOv6IChH-lkp@intel.com/config) compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 1335a05ab8bc8339ce24be3a9da89d8c3f4e0571) rustc: rustc 1.88.0 (6b00bc388 2025-06-23) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Reported-by: Dan Carpenter | Closes: https://lore.kernel.org/r/202512181203.IOv6IChH-lkp@intel.com/ smatch warnings: drivers/android/binder/rust_binderfs.c:134 binderfs_binder_device_create() error: Calling ida_alloc_max() with a 'max' argument which is a power of 2. -1 missing? drivers/android/binder/rust_binderfs.c:418 binderfs_binder_ctl_create() error: Calling ida_alloc_max() with a 'max' argument which is a power of 2. -1 missing? vim +/max +134 drivers/android/binder/rust_binderfs.c eafedbc7c050c4 Alice Ryhl 2025-09-19 130 eafedbc7c050c4 Alice Ryhl 2025-09-19 131 /* Reserve new minor number for the new device. */ eafedbc7c050c4 Alice Ryhl 2025-09-19 132 mutex_lock(&binderfs_minors_mutex); eafedbc7c050c4 Alice Ryhl 2025-09-19 133 if (++info->device_count <= info->mount_opts.max) eafedbc7c050c4 Alice Ryhl 2025-09-19 @134 minor = ida_alloc_max(&binderfs_minors, eafedbc7c050c4 Alice Ryhl 2025-09-19 135 use_reserve ? BINDERFS_MAX_MINOR : eafedbc7c050c4 Alice Ryhl 2025-09-19 136 BINDERFS_MAX_MINOR_CAPPED, ida_alloc_max() takes the maximum valid id not the count. These should be BINDERFS_MAX_MINOR - 1, BINDERFS_MAX_MINOR_CAPPED - 1. eafedbc7c050c4 Alice Ryhl 2025-09-19 137 GFP_KERNEL); eafedbc7c050c4 Alice Ryhl 2025-09-19 138 else eafedbc7c050c4 Alice Ryhl 2025-09-19 139 minor = -ENOSPC; eafedbc7c050c4 Alice Ryhl 2025-09-19 140 if (minor < 0) { eafedbc7c050c4 Alice Ryhl 2025-09-19 141 --info->device_count; eafedbc7c050c4 Alice Ryhl 2025-09-19 142 mutex_unlock(&binderfs_minors_mutex); eafedbc7c050c4 Alice Ryhl 2025-09-19 143 return minor; eafedbc7c050c4 Alice Ryhl 2025-09-19 144 } eafedbc7c050c4 Alice Ryhl 2025-09-19 145 mutex_unlock(&binderfs_minors_mutex); eafedbc7c050c4 Alice Ryhl 2025-09-19 146 eafedbc7c050c4 Alice Ryhl 2025-09-19 147 ret = -ENOMEM; eafedbc7c050c4 Alice Ryhl 2025-09-19 148 device = kzalloc(sizeof(*device), GFP_KERNEL); eafedbc7c050c4 Alice Ryhl 2025-09-19 149 if (!device) eafedbc7c050c4 Alice Ryhl 2025-09-19 150 goto err; eafedbc7c050c4 Alice Ryhl 2025-09-19 151 eafedbc7c050c4 Alice Ryhl 2025-09-19 152 req->name[BINDERFS_MAX_NAME] = '\0'; /* NUL-terminate */ eafedbc7c050c4 Alice Ryhl 2025-09-19 153 eafedbc7c050c4 Alice Ryhl 2025-09-19 154 ctx = rust_binder_new_context(req->name); eafedbc7c050c4 Alice Ryhl 2025-09-19 155 if (!ctx) eafedbc7c050c4 Alice Ryhl 2025-09-19 156 goto err; eafedbc7c050c4 Alice Ryhl 2025-09-19 157 eafedbc7c050c4 Alice Ryhl 2025-09-19 158 inode = new_inode(sb); eafedbc7c050c4 Alice Ryhl 2025-09-19 159 if (!inode) eafedbc7c050c4 Alice Ryhl 2025-09-19 160 goto err; eafedbc7c050c4 Alice Ryhl 2025-09-19 161 eafedbc7c050c4 Alice Ryhl 2025-09-19 162 inode->i_ino = minor + INODE_OFFSET; eafedbc7c050c4 Alice Ryhl 2025-09-19 163 simple_inode_init_ts(inode); eafedbc7c050c4 Alice Ryhl 2025-09-19 164 init_special_inode(inode, S_IFCHR | 0600, eafedbc7c050c4 Alice Ryhl 2025-09-19 165 MKDEV(MAJOR(binderfs_dev), minor)); eafedbc7c050c4 Alice Ryhl 2025-09-19 166 inode->i_fop = &rust_binder_fops; eafedbc7c050c4 Alice Ryhl 2025-09-19 167 inode->i_uid = info->root_uid; eafedbc7c050c4 Alice Ryhl 2025-09-19 168 inode->i_gid = info->root_gid; eafedbc7c050c4 Alice Ryhl 2025-09-19 169 eafedbc7c050c4 Alice Ryhl 2025-09-19 170 req->major = MAJOR(binderfs_dev); eafedbc7c050c4 Alice Ryhl 2025-09-19 171 req->minor = minor; eafedbc7c050c4 Alice Ryhl 2025-09-19 172 device->ctx = ctx; eafedbc7c050c4 Alice Ryhl 2025-09-19 173 device->minor = minor; eafedbc7c050c4 Alice Ryhl 2025-09-19 174 eafedbc7c050c4 Alice Ryhl 2025-09-19 175 if (userp && copy_to_user(userp, req, sizeof(*req))) { eafedbc7c050c4 Alice Ryhl 2025-09-19 176 ret = -EFAULT; eafedbc7c050c4 Alice Ryhl 2025-09-19 177 goto err; eafedbc7c050c4 Alice Ryhl 2025-09-19 178 } eafedbc7c050c4 Alice Ryhl 2025-09-19 179 eafedbc7c050c4 Alice Ryhl 2025-09-19 180 root = sb->s_root; eafedbc7c050c4 Alice Ryhl 2025-09-19 181 inode_lock(d_inode(root)); eafedbc7c050c4 Alice Ryhl 2025-09-19 182 eafedbc7c050c4 Alice Ryhl 2025-09-19 183 /* look it up */ eafedbc7c050c4 Alice Ryhl 2025-09-19 184 dentry = lookup_noperm(&QSTR(req->name), root); eafedbc7c050c4 Alice Ryhl 2025-09-19 185 if (IS_ERR(dentry)) { eafedbc7c050c4 Alice Ryhl 2025-09-19 186 inode_unlock(d_inode(root)); eafedbc7c050c4 Alice Ryhl 2025-09-19 187 ret = PTR_ERR(dentry); eafedbc7c050c4 Alice Ryhl 2025-09-19 188 goto err; eafedbc7c050c4 Alice Ryhl 2025-09-19 189 } eafedbc7c050c4 Alice Ryhl 2025-09-19 190 eafedbc7c050c4 Alice Ryhl 2025-09-19 191 if (d_really_is_positive(dentry)) { eafedbc7c050c4 Alice Ryhl 2025-09-19 192 /* already exists */ eafedbc7c050c4 Alice Ryhl 2025-09-19 193 dput(dentry); eafedbc7c050c4 Alice Ryhl 2025-09-19 194 inode_unlock(d_inode(root)); eafedbc7c050c4 Alice Ryhl 2025-09-19 195 ret = -EEXIST; eafedbc7c050c4 Alice Ryhl 2025-09-19 196 goto err; eafedbc7c050c4 Alice Ryhl 2025-09-19 197 } eafedbc7c050c4 Alice Ryhl 2025-09-19 198 eafedbc7c050c4 Alice Ryhl 2025-09-19 199 inode->i_private = device; eafedbc7c050c4 Alice Ryhl 2025-09-19 200 d_instantiate(dentry, inode); eafedbc7c050c4 Alice Ryhl 2025-09-19 201 fsnotify_create(root->d_inode, dentry); eafedbc7c050c4 Alice Ryhl 2025-09-19 202 inode_unlock(d_inode(root)); eafedbc7c050c4 Alice Ryhl 2025-09-19 203 eafedbc7c050c4 Alice Ryhl 2025-09-19 204 return 0; eafedbc7c050c4 Alice Ryhl 2025-09-19 205 eafedbc7c050c4 Alice Ryhl 2025-09-19 206 err: eafedbc7c050c4 Alice Ryhl 2025-09-19 207 kfree(device); eafedbc7c050c4 Alice Ryhl 2025-09-19 208 rust_binder_remove_context(ctx); eafedbc7c050c4 Alice Ryhl 2025-09-19 209 mutex_lock(&binderfs_minors_mutex); eafedbc7c050c4 Alice Ryhl 2025-09-19 210 --info->device_count; eafedbc7c050c4 Alice Ryhl 2025-09-19 211 ida_free(&binderfs_minors, minor); eafedbc7c050c4 Alice Ryhl 2025-09-19 212 mutex_unlock(&binderfs_minors_mutex); eafedbc7c050c4 Alice Ryhl 2025-09-19 213 iput(inode); eafedbc7c050c4 Alice Ryhl 2025-09-19 214 eafedbc7c050c4 Alice Ryhl 2025-09-19 215 return ret; eafedbc7c050c4 Alice Ryhl 2025-09-19 216 } -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki