]> www.infradead.org Git - users/jedix/linux-maple.git/commit
xarray: make xa_alloc_cyclic() return 0 on all success cases
authorPrzemek Kitszel <przemyslaw.kitszel@intel.com>
Thu, 20 Mar 2025 10:22:19 +0000 (11:22 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 12 May 2025 00:48:19 +0000 (17:48 -0700)
commit4c97a17a252bf8396f7bd65efced00bf401a8c25
treebfdfe7beb540ce8a243ac2e3d7d5a61f924c1f27
parentdbb9c166a08c7a237c79b969a19ee02baa847af1
xarray: make xa_alloc_cyclic() return 0 on all success cases

Change xa_alloc_cyclic() to return 0 even on wrap-around.  Do the same for
xa_alloc_cyclic_irq() and xa_alloc_cyclic_bh().

This will prevent any future bug of treating return of 1 as an error:
int ret = xa_alloc_cyclic(...)
if (ret) // currently mishandles ret==1
goto failure;

If there will be someone interested in when wrap-around occurs, there is
still __xa_alloc_cyclic() that behaves as before.  For now there is no
such user.

Link: https://lkml.kernel.org/r/20250320102219.8101-1-przemyslaw.kitszel@intel.com
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Suggested-by: Matthew Wilcox <willy@infradead.org>
Link: https://lore.kernel.org/netdev/Z9gUd-5t8b5NX2wE@casper.infradead.org
Cc: Andriy Shevchenko <andriy.shevchenko@intel.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Cc: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/xarray.h
lib/test_xarray.c