From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.74]) (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 18797324B3A for ; Thu, 18 Dec 2025 08:11:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766045463; cv=none; b=ppmgx62q0HAYk1VPRxNThvBkYJ70cuapwr/YVysl3vML27OH6U2xDoJmnsc+74QE3MU3IucWzp0DdswDvHNDj+M2VgVrzo8uvyucVLTi72zfB79YUrOPmlKYZ9lvzKhmyJ2VyVUv/nH8IJDohLrIOl/RUQsL6QPIdkd0eaoBu4g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766045463; c=relaxed/simple; bh=uiVn+PFW6BDRwA6pNPwXEhvpVvHeUkiEqBZQkJcZb9o=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=EliIYCVz5jbPJ48ihqiOCaxFOhgzxifpRcKJzXiomMYV/HZKy5VSMeNYWbXhWJzf9ZXqqzwvAiqwUUVEyGAyviIbOTbLr9hZ/w8IEGq2ewG/0OwTrIYz7uM2RHufn0stB6Aiu92ZHXGh06Pmv2H/UWZwvpV0Gw34oQAi1rhyEBM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=GtaN0A7p; arc=none smtp.client-ip=209.85.221.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="GtaN0A7p" Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-430f79b8d4dso246710f8f.3 for ; Thu, 18 Dec 2025 00:11:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1766045458; x=1766650258; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=lMR4ru/kjMK2+W8gXNHMkf+DOJfulikDiV7jP3bza+g=; b=GtaN0A7prd9xCQz6kR4bsLyOuj+TeWaTu5z6UENG/8HVGHUaQTChRgqeJNKhY2CgnS hqgidFXskhTK3JBriXBb8B2/HCZJ0dQHfmeoBFUv2iQo7fY8lc6Z81KVIHVslyMzHh3q QLgZnKnBwZvCxp5sPZm3zJQ3KTvq4lMmh8mqi6mOx2XITp444OzRpPZUnSqo5oJQ+EmI KidRGL4mbgPe4QMjo9n0uGMGYJewU74erzgQnEaEOhPxglt5aDj6FCABvG8KSrMqfIVu /xJaJvct3UZK81UGOUyHSMPB69GXmBox0hduCXjYkvonADeLeCg1g1Ew/4ETorimy1LG stQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766045458; x=1766650258; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lMR4ru/kjMK2+W8gXNHMkf+DOJfulikDiV7jP3bza+g=; b=XNQopAa81/zagXWbIp5EW/uKzhXQ0M2i7ZGjxU8ZpV76HCCJJeCDWtTK0FcyZDv5hH Dquuyg9ZNlNXExanaIXezep501RHkpY2P/KwdjX7RgWc6f1xK1Qny0h6nG5LxhDC6fUv v6CZ6/ibluHv5Vpw4Bn5McWmSrVHCVq4xpveM9hR+vGZivQQHM2wGYZj17vrdxdKYb+X NcA5uF44C/OzrNw5NwphqWT4EU8PPYZ9vuraoJkfAxcYTPHHWuQ02D4pYfvJN5txVTk4 7snxFDt+gK3qmdKJp1A7WfWhNGoklg7MNlKB2ofl3ysxq1XdKY+aGsiSXIdZyMSmtW6l YY2A== X-Forwarded-Encrypted: i=1; AJvYcCWt+RsESqUPetsFdeVV3AK2IJFNOrye8q3/2GeXP25iRCTMczdbG7aYPjs/tobAi1W5piZ0OX9b2za4hcc=@vger.kernel.org X-Gm-Message-State: AOJu0YzO0OqPuz472MbbfhlbN/dJ2uLX/SQbFfPg46zx1xzRKLIPFtnR cK8E9Tta9cX0L/6aqGYhgNh59qwroMNS8K73y4ddDWG/r/OYh7io6YBjS7OshNZD3H02ini3cIR nRRXqhRckDGDNj7zMLA== X-Google-Smtp-Source: AGHT+IGx+neHgD8/NWVc2BOJoOLqIncjiW6qyu9IlOCRErxi0s4CHpJulltKfG/fv8DGitKvrf9HtVpcsb8LpJA= X-Received: from wrbey10.prod.google.com ([2002:a05:6000:24ca:b0:430:f9bd:2c6a]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:2012:b0:430:ff81:296c with SMTP id ffacd0b85a97d-430ff812d35mr10959601f8f.34.1766045458352; Thu, 18 Dec 2025 00:10:58 -0800 (PST) Date: Thu, 18 Dec 2025 08:10:57 +0000 In-Reply-To: <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 References: <202512181203.IOv6IChH-lkp@intel.com> Message-ID: Subject: Re: 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? From: Alice Ryhl To: Dan Carpenter , Greg Kroah-Hartman , Carlos Llamas Cc: oe-kbuild@lists.linux.dev, lkp@intel.com, oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org, Wedson Almeida Filho , Matt Gilbride Content-Type: text/plain; charset="utf-8" On Thu, Dec 18, 2025 at 10:17:52AM +0300, Dan Carpenter wrote: > 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. Hmm, this is reported for rust_binderfs.c, but looks like binderfs.c has the same code. That means the bug has been there for a long time. Alice