All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] lib/idr: Fixes for infinite loop and memory leak
@ 2026-03-12 18:19 Josh Law
  2026-03-12 18:19 ` [PATCH v3 1/2] lib/idr: fix infinite loop in idr_get_next() Josh Law
  2026-03-12 18:19 ` [PATCH v3 2/2] lib/idr: fix memory leak in ida_alloc_range() error path Josh Law
  0 siblings, 2 replies; 7+ messages in thread
From: Josh Law @ 2026-03-12 18:19 UTC (permalink / raw)
  To: Matthew Wilcox, Andrew Morton
  Cc: linux-fsdevel, linux-mm, linux-kernel, Josh Law

This series includes two fixes for the IDR and IDA APIs, along with
their corresponding test cases as requested by reviewers.

1. Fix an infinite loop condition in idr_get_next() that occurs when
   iterating over an ID > INT_MAX.
2. Fix a memory leak in ida_alloc_range() where an intermediate
   allocated bitmap is not freed if a subsequent XArray insertion fails.

Both fixes update tools/testing/radix-tree/idr-test.c to ensure the
error paths are covered by the test suite.

Changes since v2:
- Added `idr-test.c` updates to both commits to formally test the fix conditions.

Josh Law (2):
  lib/idr: fix infinite loop in idr_get_next()
  lib/idr: fix memory leak in ida_alloc_range() error path

 lib/idr.c                           |  4 +++-
 tools/testing/radix-tree/idr-test.c | 19 ++++++++++++++++++-
 2 files changed, 21 insertions(+), 2 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [PATCH v3 2/2] lib/idr: fix memory leak in ida_alloc_range() error path
@ 2026-03-13  8:00 kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2026-03-13  8:00 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "low confidence bisect report"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20260312181948.20020-3-objecting@objecting.org>
References: <20260312181948.20020-3-objecting@objecting.org>
TO: Josh Law <hlcj1234567@gmail.com>
TO: Matthew Wilcox <willy@infradead.org>
TO: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>
CC: linux-fsdevel@vger.kernel.org
CC: linux-kernel@vger.kernel.org
CC: Josh Law <objecting@objecting.org>

Hi Josh,

kernel test robot noticed the following build errors:

[auto build test ERROR on akpm-mm/mm-nonmm-unstable]
[also build test ERROR on akpm-mm/mm-everything linus/master v7.0-rc3 next-20260312]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Josh-Law/lib-idr-fix-infinite-loop-in-idr_get_next/20260313-143607
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable
patch link:    https://lore.kernel.org/r/20260312181948.20020-3-objecting%40objecting.org
patch subject: [PATCH v3 2/2] lib/idr: fix memory leak in ida_alloc_range() error path
:::::: branch date: 74 minutes ago
:::::: commit date: 74 minutes ago
config: arm64-allnoconfig-bpf (https://download.01.org/0day-ci/archive/20260313/202603130809.cCY2uVmK-lkp@intel.com/config)
compiler: aarch64-linux-gnu-gcc (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260313/202603130809.cCY2uVmK-lkp@intel.com/reproduce)

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 <lkp@intel.com>
| Closes: https://lore.kernel.org/r/202603130809.cCY2uVmK-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   idr-test.c: In function 'user_ida_checks':
>> idr-test.c:546:9: error: implicit declaration of function 'ida_check_leak'; did you mean 'ida_check_leaf'? [-Wimplicit-function-declaration]
     546 |         ida_check_leak();
         |         ^~~~~~~~~~~~~~
         |         ida_check_leaf
   idr-test.c: At top level:
>> idr-test.c:563:13: warning: conflicting types for 'ida_check_leak'; have 'void(void)'
     563 | static void ida_check_leak(void)
         |             ^~~~~~~~~~~~~~
>> idr-test.c:563:13: error: static declaration of 'ida_check_leak' follows non-static declaration
   idr-test.c:546:9: note: previous implicit declaration of 'ida_check_leak' with type 'void(void)'
     546 |         ida_check_leak();
         |         ^~~~~~~~~~~~~~
>> idr-test.c:563:13: warning: 'ida_check_leak' defined but not used [-Wunused-function]
     563 | static void ida_check_leak(void)
         |             ^~~~~~~~~~~~~~

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-03-13  8:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-12 18:19 [PATCH v3 0/2] lib/idr: Fixes for infinite loop and memory leak Josh Law
2026-03-12 18:19 ` [PATCH v3 1/2] lib/idr: fix infinite loop in idr_get_next() Josh Law
2026-03-12 20:55   ` Andrew Morton
2026-03-12 20:57     ` Josh Law
2026-03-12 21:15       ` Josh Law
2026-03-12 18:19 ` [PATCH v3 2/2] lib/idr: fix memory leak in ida_alloc_range() error path Josh Law
  -- strict thread matches above, loose matches on Subject: below --
2026-03-13  8:00 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.