From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (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 3908C28727D for ; Tue, 27 Jan 2026 20:48:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769546912; cv=none; b=MH2Pkg+nL1YcfJEWo/cthT1HZ/CymywTv0ZiF6870D+NoZqkG5Xs/ioohB6XA5h05GRKCAaRN9N4jwW+rcKxhg0BptJKY4v0t0IzqPTG3cOxL/jlTAsqWeVuBP9/vqWV8H2X/1nMwfqczEP4rB8nA1ury7e7EUVmWmOcDwXaBq8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769546912; c=relaxed/simple; bh=VrpG/5fjPAJmxCRHqaT/bh3KQR0TfOmqRHxxtWMxe40=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VgDTFkFAjiG7Xs/PVbsVehpiLej184RzYNsPsvyVQyRopzZu9ZQjr1WgszE5lJ8yMgEsAjAFNU9L6kIEHzjrhQZt3PY/EOzlsPWJb2raIDRViw211PbKahVHuKH6vpD09YXLmCVXvQ/iSGlmeFdlGa0xohY3YtJR/H5/LMZuJTg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=GbOVjiwW; arc=none smtp.client-ip=209.85.214.171 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=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="GbOVjiwW" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-2a885af8ee7so1425ad.1 for ; Tue, 27 Jan 2026 12:48:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1769546910; x=1770151710; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ZxQ/jJ5+RCHFOsLeGzry/OBxfQLFoCbuarfI17mm5NU=; b=GbOVjiwW3LiQZQgWGgKRMwLRmDcJTOKkCr9khg97i7nUABkOXkxJOywnJ7+nml8Z5M EqKbibQZEBxkZWNtZlLY7xDrW96ZFSTPNs+urL1+vtVnOuTrnZ9oSxJ0bl8ySoH7SRdm f8OCnae9BIrDfV77NQ2QKkz2EJQuJtUpI/SEz2PTq0/Z2rcstf5H5k2ruEEFNfsnSzZH /OaL/8oyPMOU1dX+56YHGgpB8bX1Run3ZzBapdtYeHlfqiCNUqjgQIdWHd1iQ5uKZE0/ zjX5Wk0a1pT6a5fMTQXJRoiCj3MLNs5w2Rp3rfaxWbnNpgRfOAv2pFUlhAux7ldMG1dw NW5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769546910; x=1770151710; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZxQ/jJ5+RCHFOsLeGzry/OBxfQLFoCbuarfI17mm5NU=; b=kZ3Dkt2LyRAQh6zqXhWwIPIpoYA3jeC/0Alcmkb0GUScAbP/6SUAyWlspi0UGlgIni eut+xo1lQOZ39aavfOChqmztKzdqQwsUnlTDmQi2675egW6QjB1xWAxsrU/Rz4DxDUbv OfGTyanIugQTvWzK9ZiCr/vZPuLxHjd8QIRd5lOX4wZMjEgDRRpR6U5GR+bJQ2QFKPfD gt5wzt5ld6spwUHpvr0D7v+hdbJjfWiwMvUu4w+UP0p1uToYI3nE3D1f+VtDED+5XDTM NGDL4FjyA6u3x0RN+InItCj7Ncg2Ju8YB+wfyJy3aEHc7hrWr8Jik+Ob1ER0jvQQhcCe Uc3g== X-Forwarded-Encrypted: i=1; AJvYcCXE6jF5IY6q1UoOSsKDdyqptbqWd8UFLeN0G6fnSjQLqt3c4K6wpLVpR9tXYspDl2t4o/rUdB+FtRzIsE8=@vger.kernel.org X-Gm-Message-State: AOJu0Yy/FDZHW2nraTbROxZRHwATi6qB3XArAXG/FRCd8hgHgEfsAEoW HD+cjTDnULa0CAPhXAaHfDx+M14fbJjfL9rfeoEXHOfrIDgGlXqEbK3plKnfc+il1Q== X-Gm-Gg: AZuq6aJX0468Wc2XIayj7Ax03R5ZctKvT3cbtQyU1gzgw8gNxXc8WvjaaJ1/d7QCPnm gnus1JXHHfRuV3zC+hHNALe+e7oZzlWuC979H1x81fF3K81fIp3MvSwFM3ov2tB2lgc3+4oNV8W CBONnMvkWgrlnDDijA77pXv9BKD7XUouXbpMpQp4ddh1v2W2I3r26atiiA430JxY92b7Xt6Rm98 mLsG3OlUN3LuZpCEdGuxLz/qRX5jpIs09ahHy07uX15QkqgCM5Mjyyot/2fFwXyyUTPGzowTcR2 /xqvdZ6+Dw7abiwAY6KuTAO7N0nfkg3Z2GnhMW++oQ7++I+WHVF5Chn6PpUSRMJWoZX90TzO6r8 ozCw0Kw4uoqR1enbnCUsu9SI0x7LobwSRu/lluYMB+8Mn+OFN5IV0L5jadNEGAUZhg2uAO1B63Y w9pNDEMa/qnRcoUmtxEPB9uKj8JDs3cOW2yUWkukA2PJ1G959EKYc= X-Received: by 2002:a17:902:fc4c:b0:2a7:516d:18e2 with SMTP id d9443c01a7336-2a8708e53c0mr3360475ad.9.1769546910204; Tue, 27 Jan 2026 12:48:30 -0800 (PST) Received: from google.com (28.117.125.34.bc.googleusercontent.com. [34.125.117.28]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a88b4c3e04sm2043315ad.46.2026.01.27.12.48.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 12:48:29 -0800 (PST) Date: Tue, 27 Jan 2026 20:48:25 +0000 From: Carlos Llamas To: Alice Ryhl Cc: Dan Carpenter , Greg Kroah-Hartman , oe-kbuild@lists.linux.dev, lkp@intel.com, oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org, Wedson Almeida Filho , Matt Gilbride 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? Message-ID: References: <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 In-Reply-To: On Thu, Dec 18, 2025 at 08:10:57AM +0000, Alice Ryhl wrote: > 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. Yeah, this issue is also in C. Although it seems far fetch to reach that number of binder devices (1 << 20). This still needs to be fixed though as (1 << 20) overflows the max value for minor and I don't know what happens then. I'll send out a patch. -- Carlos Llamas