rust_binderfs: fix ida_alloc_max() upper bound

The 'max' argument of ida_alloc_max() takes the maximum valid ID and not
the "count". Using an ID of BINDERFS_MAX_MINOR (1 << 20) for dev->minor
would exceed the limits of minor numbers (20-bits). Fix this off-by-one
error by subtracting 1 from the 'max'.

Cc: stable@vger.kernel.org
Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/r/202512181203.IOv6IChH-lkp@intel.com/
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Link: https://patch.msgid.link/20260127235545.2307876-1-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by Carlos Llamas and committed by Greg Kroah-Hartman d6ba7348 1769f90e

+4 -4
+4 -4
drivers/android/binder/rust_binderfs.c
··· 132 132 mutex_lock(&binderfs_minors_mutex); 133 133 if (++info->device_count <= info->mount_opts.max) 134 134 minor = ida_alloc_max(&binderfs_minors, 135 - use_reserve ? BINDERFS_MAX_MINOR : 136 - BINDERFS_MAX_MINOR_CAPPED, 135 + use_reserve ? BINDERFS_MAX_MINOR - 1 : 136 + BINDERFS_MAX_MINOR_CAPPED - 1, 137 137 GFP_KERNEL); 138 138 else 139 139 minor = -ENOSPC; ··· 405 405 /* Reserve a new minor number for the new device. */ 406 406 mutex_lock(&binderfs_minors_mutex); 407 407 minor = ida_alloc_max(&binderfs_minors, 408 - use_reserve ? BINDERFS_MAX_MINOR : 409 - BINDERFS_MAX_MINOR_CAPPED, 408 + use_reserve ? BINDERFS_MAX_MINOR - 1 : 409 + BINDERFS_MAX_MINOR_CAPPED - 1, 410 410 GFP_KERNEL); 411 411 mutex_unlock(&binderfs_minors_mutex); 412 412 if (minor < 0) {