Convert 'alloc_obj' family to use the new default GFP_KERNEL argument

This was done entirely with mindless brute force, using

    git grep -l '\<k[vmz]*alloc_objs*(.*, GFP_KERNEL)' |
        xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/'

to convert the new alloc_obj() users that had a simple GFP_KERNEL
argument to just drop that argument.

Note that due to the extreme simplicity of the scripting, any slightly
more complex cases spread over multiple lines would not be triggered:
they definitely exist, but this covers the vast bulk of the cases, and
the resulting diff is also then easier to check automatically.

For the same reason the 'flex' versions will be done as a separate
conversion.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Linus Torvalds 2026-02-21 16:37:42 -08:00
parent e19e1b480a
commit bf4afc53b7
6673 changed files with 13013 additions and 13013 deletions

View file

@ -454,7 +454,7 @@ static bool assoc_array_insert_in_empty_tree(struct assoc_array_edit *edit)
pr_devel("-->%s()\n", __func__);
new_n0 = kzalloc_obj(struct assoc_array_node, GFP_KERNEL);
new_n0 = kzalloc_obj(struct assoc_array_node);
if (!new_n0)
return false;
@ -536,11 +536,11 @@ static bool assoc_array_insert_into_terminal_node(struct assoc_array_edit *edit,
* those now. We may also need a new shortcut, but we deal with that
* when we need it.
*/
new_n0 = kzalloc_obj(struct assoc_array_node, GFP_KERNEL);
new_n0 = kzalloc_obj(struct assoc_array_node);
if (!new_n0)
return false;
edit->new_meta[0] = assoc_array_node_to_ptr(new_n0);
new_n1 = kzalloc_obj(struct assoc_array_node, GFP_KERNEL);
new_n1 = kzalloc_obj(struct assoc_array_node);
if (!new_n1)
return false;
edit->new_meta[1] = assoc_array_node_to_ptr(new_n1);
@ -832,7 +832,7 @@ static bool assoc_array_insert_mid_shortcut(struct assoc_array_edit *edit,
edit->excised_meta[0] = assoc_array_shortcut_to_ptr(shortcut);
/* Create a new node now since we're going to need it anyway */
new_n0 = kzalloc_obj(struct assoc_array_node, GFP_KERNEL);
new_n0 = kzalloc_obj(struct assoc_array_node);
if (!new_n0)
return false;
edit->new_meta[0] = assoc_array_node_to_ptr(new_n0);
@ -975,7 +975,7 @@ struct assoc_array_edit *assoc_array_insert(struct assoc_array *array,
*/
BUG_ON(assoc_array_ptr_is_meta(object));
edit = kzalloc_obj(struct assoc_array_edit, GFP_KERNEL);
edit = kzalloc_obj(struct assoc_array_edit);
if (!edit)
return ERR_PTR(-ENOMEM);
edit->array = array;
@ -1087,7 +1087,7 @@ struct assoc_array_edit *assoc_array_delete(struct assoc_array *array,
pr_devel("-->%s()\n", __func__);
edit = kzalloc_obj(struct assoc_array_edit, GFP_KERNEL);
edit = kzalloc_obj(struct assoc_array_edit);
if (!edit)
return ERR_PTR(-ENOMEM);
edit->array = array;
@ -1280,7 +1280,7 @@ struct assoc_array_edit *assoc_array_clear(struct assoc_array *array,
if (!array->root)
return NULL;
edit = kzalloc_obj(struct assoc_array_edit, GFP_KERNEL);
edit = kzalloc_obj(struct assoc_array_edit);
if (!edit)
return ERR_PTR(-ENOMEM);
edit->array = array;
@ -1468,7 +1468,7 @@ int assoc_array_gc(struct assoc_array *array,
if (!array->root)
return 0;
edit = kzalloc_obj(struct assoc_array_edit, GFP_KERNEL);
edit = kzalloc_obj(struct assoc_array_edit);
if (!edit)
return -ENOMEM;
edit->array = array;
@ -1503,7 +1503,7 @@ descend:
/* Duplicate the node at this position */
node = assoc_array_ptr_to_node(cursor);
new_n = kzalloc_obj(struct assoc_array_node, GFP_KERNEL);
new_n = kzalloc_obj(struct assoc_array_node);
if (!new_n)
goto enomem;
pr_devel("dup node %p -> %p\n", node, new_n);

View file

@ -1320,7 +1320,7 @@ struct bch_control *bch_init(int m, int t, unsigned int prim_poly,
if (prim_poly == 0)
prim_poly = prim_poly_tab[m-min_m];
bch = kzalloc_obj(*bch, GFP_KERNEL);
bch = kzalloc_obj(*bch);
if (bch == NULL)
goto fail;

View file

@ -193,7 +193,7 @@ static int codetag_module_init(struct codetag_type *cttype, struct module *mod)
BUG_ON(range.start > range.stop);
cmod = kmalloc_obj(*cmod, GFP_KERNEL);
cmod = kmalloc_obj(*cmod);
if (unlikely(!cmod))
return -ENOMEM;
@ -383,7 +383,7 @@ codetag_register_type(const struct codetag_type_desc *desc)
BUG_ON(desc->tag_size <= 0);
cttype = kzalloc_obj(*cttype, GFP_KERNEL);
cttype = kzalloc_obj(*cttype);
if (unlikely(!cttype))
return ERR_PTR(-ENOMEM);

View file

@ -309,7 +309,7 @@ EXPORT_SYMBOL(irq_cpu_rmap_remove);
*/
int irq_cpu_rmap_add(struct cpu_rmap *rmap, int irq)
{
struct irq_glue *glue = kzalloc_obj(*glue, GFP_KERNEL);
struct irq_glue *glue = kzalloc_obj(*glue);
int rc;
if (!glue)

View file

@ -245,12 +245,12 @@ struct gf128mul_64k *gf128mul_init_64k_bbe(const be128 *g)
struct gf128mul_64k *t;
int i, j, k;
t = kzalloc_obj(*t, GFP_KERNEL);
t = kzalloc_obj(*t);
if (!t)
goto out;
for (i = 0; i < 16; i++) {
t->t[i] = kzalloc_obj(*t->t[i], GFP_KERNEL);
t->t[i] = kzalloc_obj(*t->t[i]);
if (!t->t[i]) {
gf128mul_free_64k(t);
t = NULL;
@ -326,7 +326,7 @@ struct gf128mul_4k *gf128mul_init_4k_lle(const be128 *g)
struct gf128mul_4k *t;
int j, k;
t = kzalloc_obj(*t, GFP_KERNEL);
t = kzalloc_obj(*t);
if (!t)
goto out;

View file

@ -372,7 +372,7 @@ mpihelp_mul_karatsuba_case(mpi_ptr_t prodp,
return -ENOMEM;
} else {
if (!ctx->next) {
ctx->next = kzalloc_obj(*ctx, GFP_KERNEL);
ctx->next = kzalloc_obj(*ctx);
if (!ctx->next)
return -ENOMEM;
}

View file

@ -33,7 +33,7 @@ MPI mpi_alloc(unsigned nlimbs)
{
MPI a;
a = kmalloc_obj(*a, GFP_KERNEL);
a = kmalloc_obj(*a);
if (!a)
return a;
@ -93,14 +93,14 @@ int mpi_resize(MPI a, unsigned nlimbs)
return 0; /* no need to do it */
if (a->d) {
p = kzalloc_objs(mpi_limb_t, nlimbs, GFP_KERNEL);
p = kzalloc_objs(mpi_limb_t, nlimbs);
if (!p)
return -ENOMEM;
memcpy(p, a->d, a->alloced * sizeof(mpi_limb_t));
kfree_sensitive(a->d);
a->d = p;
} else {
a->d = kzalloc_objs(mpi_limb_t, nlimbs, GFP_KERNEL);
a->d = kzalloc_objs(mpi_limb_t, nlimbs);
if (!a->d)
return -ENOMEM;
}

View file

@ -105,7 +105,7 @@ int net_dim_init_irq_moder(struct net_device *dev, u8 profile_flags,
struct dim_irq_moder *moder;
int len;
dev->irq_moder = kzalloc_obj(*dev->irq_moder, GFP_KERNEL);
dev->irq_moder = kzalloc_obj(*dev->irq_moder);
if (!dev->irq_moder)
return -ENOMEM;

View file

@ -1241,7 +1241,7 @@ static int ddebug_add_module(struct _ddebug_info *di, const char *modname)
return 0;
}
dt = kzalloc_obj(*dt, GFP_KERNEL);
dt = kzalloc_obj(*dt);
if (dt == NULL) {
pr_err("error adding module: %s\n", modname);
return -ENOMEM;

View file

@ -80,7 +80,7 @@ static void populate_error_injection_list(struct error_injection_entry *start,
continue;
}
ent = kmalloc_obj(*ent, GFP_KERNEL);
ent = kmalloc_obj(*ent);
if (!ent)
break;
ent->start_addr = entry;

View file

@ -47,7 +47,7 @@ static cpumask_var_t *alloc_node_to_cpumask(void)
cpumask_var_t *masks;
int node;
masks = kzalloc_objs(cpumask_var_t, nr_node_ids, GFP_KERNEL);
masks = kzalloc_objs(cpumask_var_t, nr_node_ids);
if (!masks)
return NULL;
@ -320,10 +320,10 @@ static int alloc_cluster_groups(unsigned int ncpus,
goto no_cluster;
/* Allocate memory based on cluster number. */
clusters = kzalloc_objs(*clusters, ncluster, GFP_KERNEL);
clusters = kzalloc_objs(*clusters, ncluster);
if (!clusters)
goto no_cluster;
cluster_groups = kzalloc_objs(struct node_groups, ncluster, GFP_KERNEL);
cluster_groups = kzalloc_objs(struct node_groups, ncluster);
if (!cluster_groups)
goto fail_cluster_groups;
@ -432,7 +432,7 @@ static int __group_cpus_evenly(unsigned int startgrp, unsigned int numgrps,
return numgrps;
}
node_groups = kzalloc_objs(struct node_groups, nr_node_ids, GFP_KERNEL);
node_groups = kzalloc_objs(struct node_groups, nr_node_ids);
if (!node_groups)
return -ENOMEM;
@ -506,7 +506,7 @@ struct cpumask *group_cpus_evenly(unsigned int numgrps, unsigned int *nummasks)
if (!node_to_cpumask)
goto fail_npresmsk;
masks = kzalloc_objs(*masks, numgrps, GFP_KERNEL);
masks = kzalloc_objs(*masks, numgrps);
if (!masks)
goto fail_node_to_cpumask;
@ -572,7 +572,7 @@ struct cpumask *group_cpus_evenly(unsigned int numgrps, unsigned int *nummasks)
if (numgrps == 0)
return NULL;
masks = kzalloc_objs(*masks, numgrps, GFP_KERNEL);
masks = kzalloc_objs(*masks, numgrps);
if (!masks)
return NULL;

View file

@ -311,7 +311,7 @@ static inline int span_iteration_check(void) {return 0; }
static int interval_tree_test_init(void)
{
nodes = kmalloc_objs(struct interval_tree_node, nnodes, GFP_KERNEL);
nodes = kmalloc_objs(struct interval_tree_node, nnodes);
if (!nodes)
return -ENOMEM;

View file

@ -903,7 +903,7 @@ static int want_pages_array(struct page ***res, size_t size,
count = maxpages;
WARN_ON(!count); // caller should've prevented that
if (!*res) {
*res = kvmalloc_objs(struct page *, count, GFP_KERNEL);
*res = kvmalloc_objs(struct page *, count);
if (!*res)
return 0;
}
@ -1318,7 +1318,7 @@ struct iovec *iovec_from_user(const struct iovec __user *uvec,
if (nr_segs > UIO_MAXIOV)
return ERR_PTR(-EINVAL);
if (nr_segs > fast_segs) {
iov = kmalloc_objs(struct iovec, nr_segs, GFP_KERNEL);
iov = kmalloc_objs(struct iovec, nr_segs);
if (!iov)
return ERR_PTR(-ENOMEM);
}

View file

@ -765,7 +765,7 @@ static struct kobject *kobject_create(void)
{
struct kobject *kobj;
kobj = kzalloc_obj(*kobj, GFP_KERNEL);
kobj = kzalloc_obj(*kobj);
if (!kobj)
return NULL;
@ -962,7 +962,7 @@ static struct kset *kset_create(const char *name,
struct kset *kset;
int retval;
kset = kzalloc_obj(*kset, GFP_KERNEL);
kset = kzalloc_obj(*kset);
if (!kset)
return NULL;
retval = kobject_set_name(&kset->kobj, "%s", name);

View file

@ -124,7 +124,7 @@ static int kobject_action_args(const char *buf, size_t count,
if (!count)
return -EINVAL;
env = kzalloc_obj(*env, GFP_KERNEL);
env = kzalloc_obj(*env);
if (!env)
return -ENOMEM;
@ -537,7 +537,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
}
/* environment buffer */
env = kzalloc_obj(struct kobj_uevent_env, GFP_KERNEL);
env = kzalloc_obj(struct kobj_uevent_env);
if (!env)
return -ENOMEM;
@ -776,7 +776,7 @@ static int uevent_net_init(struct net *net)
.flags = NL_CFG_F_NONROOT_RECV
};
ue_sk = kzalloc_obj(*ue_sk, GFP_KERNEL);
ue_sk = kzalloc_obj(*ue_sk);
if (!ue_sk)
return -ENOMEM;

View file

@ -410,7 +410,7 @@ struct kunit_suite *kunit_filter_attr_tests(const struct kunit_suite *const suit
kunit_suite_for_each_test_case(suite, test_case) { n++; }
filtered = kzalloc_objs(*filtered, n + 1, GFP_KERNEL);
filtered = kzalloc_objs(*filtered, n + 1);
if (!filtered) {
kfree(copy);
return ERR_PTR(-ENOMEM);

View file

@ -111,7 +111,7 @@ static struct kunit_device *kunit_device_register_internal(struct kunit *test,
struct kunit_device *kunit_dev;
int err = -ENOMEM;
kunit_dev = kzalloc_obj(*kunit_dev, GFP_KERNEL);
kunit_dev = kzalloc_obj(*kunit_dev);
if (!kunit_dev)
return ERR_PTR(err);

View file

@ -131,7 +131,7 @@ kunit_filter_glob_tests(const struct kunit_suite *const suite, const char *test_
if (!copy)
return ERR_PTR(-ENOMEM);
filtered = kzalloc_objs(*filtered, n + 1, GFP_KERNEL);
filtered = kzalloc_objs(*filtered, n + 1);
if (!filtered) {
kfree(copy);
return ERR_PTR(-ENOMEM);
@ -179,7 +179,7 @@ kunit_filter_suites(const struct kunit_suite_set *suite_set,
const size_t max = suite_set->end - suite_set->start;
copy = kzalloc_objs(*copy, max, GFP_KERNEL);
copy = kzalloc_objs(*copy, max);
if (!copy) { /* won't be able to run anything, return an empty set */
return filtered;
}

View file

@ -272,7 +272,7 @@ static void free_suite_set_at_end(struct kunit *test, const void *to_free)
if (!((struct kunit_suite_set *)to_free)->start)
return;
free = kzalloc_obj(struct kunit_suite_set, GFP_KERNEL);
free = kzalloc_obj(struct kunit_suite_set);
*free = *(struct kunit_suite_set *)to_free;
kunit_add_action(test, free_suite_set, (void *)free);

View file

@ -283,7 +283,7 @@ static void example_slow_test(struct kunit *test)
*/
static int example_resource_init(struct kunit_resource *res, void *context)
{
int *info = kmalloc_obj(*info, GFP_KERNEL);
int *info = kmalloc_obj(*info);
if (!info)
return -ENOMEM;

View file

@ -538,7 +538,7 @@ static void kunit_resource_test_action_ordering(struct kunit *test)
static int kunit_resource_test_init(struct kunit *test)
{
struct kunit_test_resource_context *ctx = kzalloc_obj(*ctx, GFP_KERNEL);
struct kunit_test_resource_context *ctx = kzalloc_obj(*ctx);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);

View file

@ -98,7 +98,7 @@ int kunit_add_action(struct kunit *test, void (*action)(void *), void *ctx)
KUNIT_ASSERT_NOT_NULL_MSG(test, action, "Tried to action a NULL function!");
action_ctx = kzalloc_obj(*action_ctx, GFP_KERNEL);
action_ctx = kzalloc_obj(*action_ctx);
if (!action_ctx)
return -ENOMEM;

View file

@ -111,7 +111,7 @@ void __kunit_activate_static_stub(struct kunit *test,
/* We got an extra reference from find_resource(), so put it. */
kunit_put_resource(res);
} else {
ctx = kmalloc_obj(*ctx, GFP_KERNEL);
ctx = kmalloc_obj(*ctx);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
ctx->real_fn_addr = real_fn_addr;
ctx->replacement_addr = replacement_addr;

View file

@ -48,7 +48,7 @@ int logic_iomem_add_region(struct resource *resource,
if (WARN_ON((resource->flags & IORESOURCE_TYPE_BITS) != IORESOURCE_MEM))
return -EINVAL;
rreg = kzalloc_obj(*rreg, GFP_KERNEL);
rreg = kzalloc_obj(*rreg);
if (!rreg)
return -ENOMEM;

View file

@ -94,14 +94,14 @@ struct lru_cache *lc_create(const char *name, struct kmem_cache *cache,
if (e_count > LC_MAX_ACTIVE)
return NULL;
slot = kzalloc_objs(struct hlist_head, e_count, GFP_KERNEL);
slot = kzalloc_objs(struct hlist_head, e_count);
if (!slot)
goto out_fail;
element = kzalloc_objs(struct lc_element *, e_count, GFP_KERNEL);
element = kzalloc_objs(struct lc_element *, e_count);
if (!element)
goto out_fail;
lc = kzalloc_obj(*lc, GFP_KERNEL);
lc = kzalloc_obj(*lc);
if (!lc)
goto out_fail;

View file

@ -110,7 +110,7 @@ static int lwq_test(void)
for (i = 0; i < ARRAY_SIZE(threads); i++)
threads[i] = kthread_run(lwq_exercise, &q, "lwq-test-%d", i);
for (i = 0; i < 100; i++) {
t = kmalloc_obj(*t, GFP_KERNEL);
t = kmalloc_obj(*t);
if (!t)
break;
t->i = i;

View file

@ -525,7 +525,7 @@ struct objagg *objagg_create(const struct objagg_ops *ops,
!ops->delta_destroy))
return ERR_PTR(-EINVAL);
objagg = kzalloc_obj(*objagg, GFP_KERNEL);
objagg = kzalloc_obj(*objagg);
if (!objagg)
return ERR_PTR(-ENOMEM);
objagg->ops = ops;
@ -786,11 +786,11 @@ static struct objagg_tmp_graph *objagg_tmp_graph_create(struct objagg *objagg)
struct objagg_obj *objagg_obj;
int i, j;
graph = kzalloc_obj(*graph, GFP_KERNEL);
graph = kzalloc_obj(*graph);
if (!graph)
return NULL;
graph->nodes = kzalloc_objs(*graph->nodes, nodes_count, GFP_KERNEL);
graph->nodes = kzalloc_objs(*graph->nodes, nodes_count);
if (!graph->nodes)
goto err_nodes_alloc;
graph->nodes_count = nodes_count;
@ -930,7 +930,7 @@ struct objagg_hints *objagg_hints_get(struct objagg *objagg,
struct objagg_hints *objagg_hints;
int err;
objagg_hints = kzalloc_obj(*objagg_hints, GFP_KERNEL);
objagg_hints = kzalloc_obj(*objagg_hints);
if (!objagg_hints)
return ERR_PTR(-ENOMEM);

View file

@ -268,7 +268,7 @@ struct parman *parman_create(const struct parman_ops *ops, void *priv)
{
struct parman *parman;
parman = kzalloc_obj(*parman, GFP_KERNEL);
parman = kzalloc_obj(*parman);
if (!parman)
return NULL;
INIT_LIST_HEAD(&parman->prio_list);

View file

@ -287,7 +287,7 @@ pldm_parse_desc_tlvs(struct pldmfw_priv *data, struct pldmfw_record *record, u8
if (err)
return err;
desc = kzalloc_obj(*desc, GFP_KERNEL);
desc = kzalloc_obj(*desc);
if (!desc)
return -ENOMEM;
@ -328,7 +328,7 @@ pldm_parse_one_record(struct pldmfw_priv *data,
int i;
/* Make a copy and insert it into the record list */
record = kzalloc_obj(*record, GFP_KERNEL);
record = kzalloc_obj(*record);
if (!record)
return -ENOMEM;
@ -465,7 +465,7 @@ static int pldm_parse_components(struct pldmfw_priv *data)
if (err)
return err;
component = kzalloc_obj(*component, GFP_KERNEL);
component = kzalloc_obj(*component);
if (!component)
return -ENOMEM;
@ -848,7 +848,7 @@ int pldmfw_flash_image(struct pldmfw *context, const struct firmware *fw)
struct pldmfw_priv *data;
int err;
data = kzalloc_obj(*data, GFP_KERNEL);
data = kzalloc_obj(*data);
if (!data)
return -ENOMEM;

View file

@ -399,7 +399,7 @@ static int augmented_check(void)
static int __init rbtree_test_init(void)
{
nodes = kmalloc_objs(*nodes, nnodes, GFP_KERNEL);
nodes = kmalloc_objs(*nodes, nnodes);
if (!nodes)
return -ENOMEM;

View file

@ -111,7 +111,7 @@ static struct wspace *alloc_ws(struct rs_codec *rs)
struct wspace *ws;
int nn = rs->nn;
ws = kzalloc_obj(*ws, GFP_KERNEL);
ws = kzalloc_obj(*ws);
if (!ws)
return NULL;
@ -124,7 +124,7 @@ static struct wspace *alloc_ws(struct rs_codec *rs)
ws->s = ws->r + nn;
ws->corr = ws->s + nroots;
ws->errlocs = kmalloc_objs(int, nn + nroots, GFP_KERNEL);
ws->errlocs = kmalloc_objs(int, nn + nroots);
if (!ws->errlocs)
goto err;

View file

@ -260,7 +260,7 @@ int stack_depot_init(void)
entries = 1UL << STACK_BUCKET_NUMBER_ORDER_MAX;
pr_info("allocating hash table of %lu entries via kvcalloc\n", entries);
stack_table = kvzalloc_objs(struct list_head, entries, GFP_KERNEL);
stack_table = kvzalloc_objs(struct list_head, entries);
if (!stack_table) {
pr_err("hash table allocation failed, disabling\n");
stack_depot_disabled = true;

View file

@ -147,7 +147,7 @@ int parse_int_array(const char *buf, size_t count, int **array)
if (!nints)
return -ENOENT;
ints = kzalloc_objs(*ints, nints + 1, GFP_KERNEL);
ints = kzalloc_objs(*ints, nints + 1);
if (!ints)
return -ENOMEM;

View file

@ -94,7 +94,7 @@ static int bpf_fill_maxinsns1(struct bpf_test *self)
__u32 k = ~0;
int i;
insn = kmalloc_objs(*insn, len, GFP_KERNEL);
insn = kmalloc_objs(*insn, len);
if (!insn)
return -ENOMEM;
@ -113,7 +113,7 @@ static int bpf_fill_maxinsns2(struct bpf_test *self)
struct sock_filter *insn;
int i;
insn = kmalloc_objs(*insn, len, GFP_KERNEL);
insn = kmalloc_objs(*insn, len);
if (!insn)
return -ENOMEM;
@ -133,7 +133,7 @@ static int bpf_fill_maxinsns3(struct bpf_test *self)
struct rnd_state rnd;
int i;
insn = kmalloc_objs(*insn, len, GFP_KERNEL);
insn = kmalloc_objs(*insn, len);
if (!insn)
return -ENOMEM;
@ -159,7 +159,7 @@ static int bpf_fill_maxinsns4(struct bpf_test *self)
struct sock_filter *insn;
int i;
insn = kmalloc_objs(*insn, len, GFP_KERNEL);
insn = kmalloc_objs(*insn, len);
if (!insn)
return -ENOMEM;
@ -178,7 +178,7 @@ static int bpf_fill_maxinsns5(struct bpf_test *self)
struct sock_filter *insn;
int i;
insn = kmalloc_objs(*insn, len, GFP_KERNEL);
insn = kmalloc_objs(*insn, len);
if (!insn)
return -ENOMEM;
@ -201,7 +201,7 @@ static int bpf_fill_maxinsns6(struct bpf_test *self)
struct sock_filter *insn;
int i;
insn = kmalloc_objs(*insn, len, GFP_KERNEL);
insn = kmalloc_objs(*insn, len);
if (!insn)
return -ENOMEM;
@ -223,7 +223,7 @@ static int bpf_fill_maxinsns7(struct bpf_test *self)
struct sock_filter *insn;
int i;
insn = kmalloc_objs(*insn, len, GFP_KERNEL);
insn = kmalloc_objs(*insn, len);
if (!insn)
return -ENOMEM;
@ -249,7 +249,7 @@ static int bpf_fill_maxinsns8(struct bpf_test *self)
struct sock_filter *insn;
int i, jmp_off = len - 3;
insn = kmalloc_objs(*insn, len, GFP_KERNEL);
insn = kmalloc_objs(*insn, len);
if (!insn)
return -ENOMEM;
@ -272,7 +272,7 @@ static int bpf_fill_maxinsns9(struct bpf_test *self)
struct bpf_insn *insn;
int i;
insn = kmalloc_objs(*insn, len, GFP_KERNEL);
insn = kmalloc_objs(*insn, len);
if (!insn)
return -ENOMEM;
@ -298,7 +298,7 @@ static int bpf_fill_maxinsns10(struct bpf_test *self)
struct bpf_insn *insn;
int i;
insn = kmalloc_objs(*insn, len, GFP_KERNEL);
insn = kmalloc_objs(*insn, len);
if (!insn)
return -ENOMEM;
@ -324,7 +324,7 @@ static int __bpf_fill_ja(struct bpf_test *self, unsigned int len,
unsigned int rlen;
int i, j;
insn = kmalloc_objs(*insn, len, GFP_KERNEL);
insn = kmalloc_objs(*insn, len);
if (!insn)
return -ENOMEM;
@ -358,7 +358,7 @@ static int bpf_fill_maxinsns12(struct bpf_test *self)
struct sock_filter *insn;
int i = 0;
insn = kmalloc_objs(*insn, len, GFP_KERNEL);
insn = kmalloc_objs(*insn, len);
if (!insn)
return -ENOMEM;
@ -381,7 +381,7 @@ static int bpf_fill_maxinsns13(struct bpf_test *self)
struct sock_filter *insn;
int i = 0;
insn = kmalloc_objs(*insn, len, GFP_KERNEL);
insn = kmalloc_objs(*insn, len);
if (!insn)
return -ENOMEM;
@ -410,7 +410,7 @@ static int bpf_fill_ld_abs_get_processor_id(struct bpf_test *self)
struct sock_filter *insn;
int i;
insn = kmalloc_objs(*insn, len, GFP_KERNEL);
insn = kmalloc_objs(*insn, len);
if (!insn)
return -ENOMEM;
@ -434,7 +434,7 @@ static int __bpf_fill_stxdw(struct bpf_test *self, int size)
struct bpf_insn *insn;
int i;
insn = kmalloc_objs(*insn, len, GFP_KERNEL);
insn = kmalloc_objs(*insn, len);
if (!insn)
return -ENOMEM;
@ -484,7 +484,7 @@ static int __bpf_fill_max_jmp(struct bpf_test *self, int jmp, int imm, bool alu3
int len = S16_MAX + 5;
int i;
insns = kmalloc_objs(*insns, len, GFP_KERNEL);
insns = kmalloc_objs(*insns, len);
if (!insns)
return -ENOMEM;
@ -626,7 +626,7 @@ static int __bpf_fill_alu_shift(struct bpf_test *self, u8 op,
int imm, k;
int i = 0;
insn = kmalloc_objs(*insn, len, GFP_KERNEL);
insn = kmalloc_objs(*insn, len);
if (!insn)
return -ENOMEM;
@ -759,7 +759,7 @@ static int __bpf_fill_alu_shift_same_reg(struct bpf_test *self, u8 op,
int i = 0;
u64 val;
insn = kmalloc_objs(*insn, len, GFP_KERNEL);
insn = kmalloc_objs(*insn, len);
if (!insn)
return -ENOMEM;
@ -1244,7 +1244,7 @@ static int __bpf_fill_alu_imm_regs(struct bpf_test *self, u8 op, bool alu32)
u32 imm;
int rd;
insns = kmalloc_objs(*insns, len, GFP_KERNEL);
insns = kmalloc_objs(*insns, len);
if (!insns)
return -ENOMEM;
@ -1426,7 +1426,7 @@ static int __bpf_fill_alu_reg_pairs(struct bpf_test *self, u8 op, bool alu32)
int rd, rs;
int i = 0;
insns = kmalloc_objs(*insns, len, GFP_KERNEL);
insns = kmalloc_objs(*insns, len);
if (!insns)
return -ENOMEM;
@ -1917,7 +1917,7 @@ static int __bpf_fill_atomic_reg_pairs(struct bpf_test *self, u8 width, u8 op)
u64 mem, upd, res;
int rd, rs, i = 0;
insn = kmalloc_objs(*insn, len, GFP_KERNEL);
insn = kmalloc_objs(*insn, len);
if (!insn)
return -ENOMEM;
@ -2163,7 +2163,7 @@ static int bpf_fill_ld_imm64_magn(struct bpf_test *self)
int bit, adj, sign;
int i = 0;
insn = kmalloc_objs(*insn, len, GFP_KERNEL);
insn = kmalloc_objs(*insn, len);
if (!insn)
return -ENOMEM;
@ -2217,7 +2217,7 @@ static int __bpf_fill_ld_imm64_bytes(struct bpf_test *self,
u32 rand = 1;
int i = 0;
insn = kmalloc_objs(*insn, len, GFP_KERNEL);
insn = kmalloc_objs(*insn, len);
if (!insn)
return -ENOMEM;
@ -2724,7 +2724,7 @@ static int __bpf_fill_staggered_jumps(struct bpf_test *self,
struct bpf_insn *insns;
int off, ind;
insns = kmalloc_objs(*insns, len, GFP_KERNEL);
insns = kmalloc_objs(*insns, len);
if (!insns)
return -ENOMEM;

View file

@ -29,7 +29,7 @@ static int __init test_debug_virtual_init(void)
pr_info("PA: %pa for VA: 0x%lx\n", &pa, (unsigned long)va);
foo = kzalloc_obj(*foo, GFP_KERNEL);
foo = kzalloc_obj(*foo);
if (!foo)
return -ENOMEM;

View file

@ -1309,7 +1309,7 @@ static ssize_t upload_register_store(struct device *dev,
goto free_name;
}
tst = kzalloc_obj(*tst, GFP_KERNEL);
tst = kzalloc_obj(*tst);
if (!tst) {
ret = -ENOMEM;
goto free_name;
@ -1526,7 +1526,7 @@ static int __init test_firmware_init(void)
{
int rc;
test_fw_config = kzalloc_obj(struct test_config, GFP_KERNEL);
test_fw_config = kzalloc_obj(struct test_config);
if (!test_fw_config)
return -ENOMEM;

View file

@ -166,7 +166,7 @@ static int dmirror_fops_open(struct inode *inode, struct file *filp)
int ret;
/* Mirror this process address space */
dmirror = kzalloc_obj(*dmirror, GFP_KERNEL);
dmirror = kzalloc_obj(*dmirror);
if (dmirror == NULL)
return -ENOMEM;
@ -504,7 +504,7 @@ static int dmirror_allocate_chunk(struct dmirror_device *mdevice,
void *ptr;
int ret = -ENOMEM;
devmem = kzalloc_obj(*devmem, GFP_KERNEL);
devmem = kzalloc_obj(*devmem);
if (!devmem)
return ret;

View file

@ -211,7 +211,7 @@ static int kho_test_save(void)
max_mem = PAGE_ALIGN(max_mem);
max_nr = max_mem >> PAGE_SHIFT;
folios = kvmalloc_objs(*state->folios, max_nr, GFP_KERNEL);
folios = kvmalloc_objs(*state->folios, max_nr);
if (!folios)
return -ENOMEM;
state->folios = folios;

View file

@ -24,20 +24,20 @@ static int __init test_memcat_p_init(void)
struct test_struct **in0, **in1, **out, **p;
int err = -ENOMEM, i, r, total = 0;
in0 = kzalloc_objs(*in0, INPUT_MAX, GFP_KERNEL);
in0 = kzalloc_objs(*in0, INPUT_MAX);
if (!in0)
return err;
in1 = kzalloc_objs(*in1, INPUT_MAX, GFP_KERNEL);
in1 = kzalloc_objs(*in1, INPUT_MAX);
if (!in1)
goto err_free_in0;
for (i = 0, r = 1; i < INPUT_MAX - 1; i++) {
in0[i] = kmalloc_obj(**in0, GFP_KERNEL);
in0[i] = kmalloc_obj(**in0);
if (!in0[i])
goto err_free_elements;
in1[i] = kmalloc_obj(**in1, GFP_KERNEL);
in1[i] = kmalloc_obj(**in1);
if (!in1[i]) {
kfree(in0[i]);
goto err_free_elements;

View file

@ -107,7 +107,7 @@ static void *delta_create(void *priv, void *parent_obj, void *obj)
if (!delta_check(priv, parent_obj, obj))
return ERR_PTR(-EINVAL);
delta = kzalloc_obj(*delta, GFP_KERNEL);
delta = kzalloc_obj(*delta);
if (!delta)
return ERR_PTR(-ENOMEM);
delta->key_id_diff = diff;
@ -130,7 +130,7 @@ static void *root_create(void *priv, void *obj, unsigned int id)
struct tokey *key = obj;
struct root *root;
root = kzalloc_obj(*root, GFP_KERNEL);
root = kzalloc_obj(*root);
if (!root)
return ERR_PTR(-ENOMEM);
memcpy(&root->key, key, sizeof(root->key));

View file

@ -219,7 +219,7 @@ static struct test_parman *test_parman_create(const struct parman_ops *ops)
struct test_parman *test_parman;
int err;
test_parman = kzalloc_obj(*test_parman, GFP_KERNEL);
test_parman = kzalloc_obj(*test_parman);
if (!test_parman)
return ERR_PTR(-ENOMEM);
err = test_parman_resize(test_parman, TEST_PARMAN_BASE_COUNT);

View file

@ -524,7 +524,7 @@ static int __init test_insert_dup(struct test_obj_rhl *rhl_test_objects,
const char *key;
int err = 0;
rhlt = kmalloc_obj(*rhlt, GFP_KERNEL);
rhlt = kmalloc_obj(*rhlt);
if (WARN_ON(!rhlt))
return -EINVAL;

View file

@ -396,7 +396,7 @@ vm_map_ram_test(void)
int i;
map_nr_pages = nr_pages > 0 ? nr_pages:1;
pages = kzalloc_objs(struct page *, map_nr_pages, GFP_KERNEL);
pages = kzalloc_objs(struct page *, map_nr_pages);
if (!pages)
return -1;
@ -542,7 +542,7 @@ init_test_configuration(void)
nr_threads = clamp(nr_threads, 1, (int) USHRT_MAX);
/* Allocate the space for test instances. */
tdriver = kvzalloc_objs(*tdriver, nr_threads, GFP_KERNEL);
tdriver = kvzalloc_objs(*tdriver, nr_threads);
if (tdriver == NULL)
return -1;

View file

@ -387,7 +387,7 @@ static void __init iov_kunit_load_folioq(struct kunit *test,
for (i = 0; i < npages; i++) {
if (folioq_full(p)) {
p->next = kzalloc_obj(struct folio_queue, GFP_KERNEL);
p->next = kzalloc_obj(struct folio_queue);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, p->next);
folioq_init(p->next, 0);
p->next->prev = p;
@ -403,7 +403,7 @@ static struct folio_queue *iov_kunit_create_folioq(struct kunit *test)
{
struct folio_queue *folioq;
folioq = kzalloc_obj(struct folio_queue, GFP_KERNEL);
folioq = kzalloc_obj(struct folio_queue);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, folioq);
kunit_add_action_or_reset(test, iov_kunit_destroy_folioq, folioq);
folioq_init(folioq, 0);
@ -565,7 +565,7 @@ static struct xarray *iov_kunit_create_xarray(struct kunit *test)
{
struct xarray *xarray;
xarray = kzalloc_obj(struct xarray, GFP_KERNEL);
xarray = kzalloc_obj(struct xarray);
xa_init(xarray);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xarray);
kunit_add_action_or_reset(test, iov_kunit_destroy_xarray, xarray);

View file

@ -591,7 +591,7 @@ enum xz_ret xz_dec_bcj_run(struct xz_dec_bcj *s, struct xz_dec_lzma2 *lzma2,
struct xz_dec_bcj *xz_dec_bcj_create(bool single_call)
{
struct xz_dec_bcj *s = kmalloc_obj(*s, GFP_KERNEL);
struct xz_dec_bcj *s = kmalloc_obj(*s);
if (s != NULL)
s->single_call = single_call;

View file

@ -1138,7 +1138,7 @@ enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s, struct xz_buf *b)
struct xz_dec_lzma2 *xz_dec_lzma2_create(enum xz_mode mode, uint32_t dict_max)
{
struct xz_dec_lzma2 *s = kmalloc_obj(*s, GFP_KERNEL);
struct xz_dec_lzma2 *s = kmalloc_obj(*s);
if (s == NULL)
return NULL;
@ -1296,7 +1296,7 @@ struct xz_dec_microlzma *xz_dec_microlzma_alloc(enum xz_mode mode,
if (dict_size < 4096 || dict_size > (3U << 30))
return NULL;
s = kmalloc_obj(*s, GFP_KERNEL);
s = kmalloc_obj(*s);
if (s == NULL)
return NULL;

View file

@ -784,7 +784,7 @@ enum xz_ret xz_dec_run(struct xz_dec *s, struct xz_buf *b)
struct xz_dec *xz_dec_init(enum xz_mode mode, uint32_t dict_max)
{
struct xz_dec *s = kmalloc_obj(*s, GFP_KERNEL);
struct xz_dec *s = kmalloc_obj(*s);
if (s == NULL)
return NULL;

View file

@ -14,7 +14,7 @@ int zlib_inflate_blob(void *gunzip_buf, unsigned int sz,
int rc;
rc = -ENOMEM;
strm = kmalloc_obj(*strm, GFP_KERNEL);
strm = kmalloc_obj(*strm);
if (strm == NULL)
goto gunzip_nomem1;
strm->workspace = kmalloc(zlib_inflate_workspacesize(), GFP_KERNEL);