c
#define MAX_SAFE_INDEX 1000000  // Choose an appropriate maximum value
index = ida_alloc_max(&ida_index, MAX_SAFE_INDEX, GFP_KERNEL);
if (index < 0) {
    pr_warn("%s: failed to allocate index within safe range!\n", name);
    rc = -ENOMEM;
    goto err;
}
