diff --git a/scst/src/kunit/order/suites/scst_kunit_order.c b/scst/src/kunit/order/suites/scst_kunit_order.c index e4403fcea..26d9a68d4 100644 --- a/scst/src/kunit/order/suites/scst_kunit_order.c +++ b/scst/src/kunit/order/suites/scst_kunit_order.c @@ -38,7 +38,7 @@ static int order_test_init(struct kunit *test) test->priv = NULL; /* Workers may outlive a failed test; KUnit must not reclaim their state. */ - f = kzalloc_obj(*f, GFP_KERNEL); + f = kzalloc_obj(*f); if (!f) return -ENOMEM; if (!try_module_get(THIS_MODULE)) { diff --git a/scst/src/kunit/unmap/suites/scst_kunit_unmap.c b/scst/src/kunit/unmap/suites/scst_kunit_unmap.c index 4ed6b1770..ab1892383 100644 --- a/scst/src/kunit/unmap/suites/scst_kunit_unmap.c +++ b/scst/src/kunit/unmap/suites/scst_kunit_unmap.c @@ -245,7 +245,7 @@ static void unmap_overlap(struct kunit *test) KUNIT_ASSERT_EQ(test, f->unmap.cmd_data_descriptors_cnt, (int)p->count); if (p->count) { /* Bound the old sentinel walk without changing the published count. */ - guarded = kcalloc(p->count + 2, sizeof(*guarded), GFP_KERNEL); + guarded = kzalloc_objs(*guarded, p->count + 2); KUNIT_ASSERT_NOT_NULL(test, guarded); memcpy(guarded, f->unmap.cmd_data_descriptors, p->count * sizeof(*guarded)); if (p->guard_overlap) { diff --git a/scst/src/scst_copy_mgr.c b/scst/src/scst_copy_mgr.c index 3f338be50..0eb134b66 100644 --- a/scst/src/scst_copy_mgr.c +++ b/scst/src/scst_copy_mgr.c @@ -1891,7 +1891,7 @@ static struct scst_cm_list_id *scst_cm_add_list_id(struct scst_cmd *cmd, int lis TRACE_ENTRY(); - res = kzalloc(sizeof(*res), GFP_KERNEL); + res = kzalloc_obj(*res); if (!res) { TRACE(TRACE_OUT_OF_MEM, "Unable to allocate list_id"); scst_set_busy(cmd); diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 359cff2bb..08cdf7452 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -6790,8 +6790,7 @@ static int scst_ws_sg_tails_get(struct scst_data_descriptor *where, struct scst_ while (where[i].sdd_blocks != 0) i++; - wsp->ws_sg_tails = kcalloc(i + 1, sizeof(*wsp->ws_sg_tails), - GFP_KERNEL); + wsp->ws_sg_tails = kzalloc_objs(*wsp->ws_sg_tails, i + 1); if (wsp->ws_sg_tails == NULL) { PRINT_ERROR("Unable to allocate ws_sg_tails (size %zd)", sizeof(*wsp->ws_sg_tails)*i); @@ -6870,7 +6869,7 @@ void scst_write_same(struct scst_cmd *cmd, struct scst_data_descriptor *where) if (unlikely(rc != 0)) goto out_done; - wsp = kzalloc(sizeof(*wsp), GFP_KERNEL); + wsp = kzalloc_obj(*wsp); if (wsp == NULL) { PRINT_ERROR("Unable to allocate ws_priv (size %zd, cmd %p)", sizeof(*wsp), cmd); @@ -7416,7 +7415,7 @@ struct scst_session *scst_alloc_session(struct scst_tgt *tgt, gfp_t gfp_mask, * for the GFP_ATOMIC case. */ sess->lat_stats = gfp_mask & GFP_ATOMIC ? - kzalloc(sizeof(*sess->lat_stats), gfp_mask) : + kzalloc_obj(*sess->lat_stats, gfp_mask) : vzalloc(sizeof(*sess->lat_stats)); if (!sess->lat_stats) goto out_free_name; diff --git a/scst/src/scst_pres.c b/scst/src/scst_pres.c index 941c04f73..9a6694a42 100644 --- a/scst/src/scst_pres.c +++ b/scst/src/scst_pres.c @@ -2254,7 +2254,7 @@ void scst_pr_preempt_and_abort(struct scst_cmd *cmd, uint8_t *buffer, int buffer scst_assert_pr_mutex_held(cmd->dev); - cmd->pr_abort_counter = kzalloc(sizeof(*cmd->pr_abort_counter), GFP_KERNEL); + cmd->pr_abort_counter = kzalloc_obj(*cmd->pr_abort_counter); if (!cmd->pr_abort_counter) { PRINT_ERROR("Unable to allocate PR abort counter (size %zd)", sizeof(*cmd->pr_abort_counter));