[PATCH 2/7 V3] idr: fix unexpected ID-removal when idr_remove(unallocated_id)

2014-04-22 Thread Lai Jiangshan
If unallocated_id = (ANY * idr_max(idp->layers) + existing_id) is passed to idr_remove(). The existing_id will be removed unexpectedly. The following test shows this unexpected id-removal: static void test4(void) { int id; DEFINE_IDR(test_idr); printk(KERN_INFO "Start

[PATCH 2/7 V3] idr: fix unexpected ID-removal when idr_remove(unallocated_id)

2014-04-22 Thread Lai Jiangshan
If unallocated_id = (ANY * idr_max(idp-layers) + existing_id) is passed to idr_remove(). The existing_id will be removed unexpectedly. The following test shows this unexpected id-removal: static void test4(void) { int id; DEFINE_IDR(test_idr); printk(KERN_INFO Start