if (update_buf_count == 0)
RETURN(err_serious(-EPROTO));
- OBD_ALLOC(update_bufs, sizeof(*update_bufs) * update_buf_count);
+ OBD_ALLOC_PTR_ARRAY(update_bufs, update_buf_count);
if (update_bufs == NULL)
RETURN(err_serious(-ENOMEM));
}
}
- OBD_FREE(update_bufs, sizeof(*update_bufs) * update_buf_count);
+ OBD_FREE_PTR_ARRAY(update_bufs, update_buf_count);
}
if (desc != NULL)
if (ta->ta_alloc_args >= new_alloc_ta)
return 0;
- OBD_ALLOC(new_ta, sizeof(*new_ta) * new_alloc_ta);
+ OBD_ALLOC_PTR_ARRAY(new_ta, new_alloc_ta);
if (new_ta == NULL)
return -ENOMEM;
/* free the old args */
if (ta->ta_args != NULL)
- OBD_FREE(ta->ta_args, sizeof(ta->ta_args[0]) *
- ta->ta_alloc_args);
+ OBD_FREE_PTR_ARRAY(ta->ta_args, ta->ta_alloc_args);
ta->ta_args = new_ta;
ta->ta_alloc_args = new_alloc_ta;
if (new_ta[i] != NULL)
OBD_FREE_PTR(new_ta[i]);
}
- OBD_FREE(new_ta, sizeof(*new_ta) * new_alloc_ta);
+ OBD_FREE_PTR_ARRAY(new_ta, new_alloc_ta);
}
return rc;
}
rdpg->rp_npages = (rdpg->rp_count + PAGE_SIZE - 1) >> PAGE_SHIFT;
/* allocate pages to store the containers */
- OBD_ALLOC(rdpg->rp_pages, rdpg->rp_npages * sizeof(rdpg->rp_pages[0]));
+ OBD_ALLOC_PTR_ARRAY(rdpg->rp_pages, rdpg->rp_npages);
if (rdpg->rp_pages == NULL)
GOTO(out, rc = -ENOMEM);
for (i = 0; i < rdpg->rp_npages; i++) {
for (i = 0; i < rdpg->rp_npages; i++)
if (rdpg->rp_pages[i])
__free_page(rdpg->rp_pages[i]);
- OBD_FREE(rdpg->rp_pages,
- rdpg->rp_npages * sizeof(rdpg->rp_pages[0]));
+ OBD_FREE_PTR_ARRAY(rdpg->rp_pages, rdpg->rp_npages);
}
return rc;
}
}
if (args->ta_args != NULL)
- OBD_FREE(args->ta_args, sizeof(args->ta_args[0]) *
- args->ta_alloc_args);
+ OBD_FREE_PTR_ARRAY(args->ta_args, args->ta_alloc_args);
OBD_SLAB_FREE_PTR(info, tgt_thread_kmem);
}
}
if (args->ta_args != NULL)
- OBD_FREE(args->ta_args, sizeof(args->ta_args[0]) *
- args->ta_alloc_args);
+ OBD_FREE_PTR_ARRAY(args->ta_args, args->ta_alloc_args);
if (info->uti_tur.tur_update_records != NULL)
OBD_FREE_LARGE(info->uti_tur.tur_update_records,