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

@ -255,7 +255,7 @@ static int acct_on(const char __user *name)
if (!(file->f_mode & FMODE_CAN_WRITE))
return -EIO;
acct = kzalloc_obj(struct bsd_acct_struct, GFP_KERNEL);
acct = kzalloc_obj(struct bsd_acct_struct);
if (!acct)
return -ENOMEM;

View file

@ -261,7 +261,7 @@ bool async_schedule_dev_nocall(async_func_t func, struct device *dev)
{
struct async_entry *entry;
entry = kzalloc_obj(struct async_entry, GFP_KERNEL);
entry = kzalloc_obj(struct async_entry);
/* Give up if there is no memory or too much work. */
if (!entry || atomic_read(&entry_count) > MAX_WORK) {

View file

@ -545,7 +545,7 @@ static int auditd_set(struct pid *pid, u32 portid, struct net *net,
if (!pid || !net)
return -EINVAL;
ac_new = kzalloc_obj(*ac_new, GFP_KERNEL);
ac_new = kzalloc_obj(*ac_new);
if (!ac_new)
return -ENOMEM;
ac_new->pid = get_pid(pid);
@ -1044,7 +1044,7 @@ static void audit_send_reply(struct sk_buff *request_skb, int seq, int type, int
struct task_struct *tsk;
struct audit_reply *reply;
reply = kzalloc_obj(*reply, GFP_KERNEL);
reply = kzalloc_obj(*reply);
if (!reply)
return;

View file

@ -89,7 +89,7 @@ struct audit_fsnotify_mark *audit_alloc_mark(struct audit_krule *krule, char *pa
goto out;
}
audit_mark = kzalloc_obj(*audit_mark, GFP_KERNEL);
audit_mark = kzalloc_obj(*audit_mark);
if (unlikely(!audit_mark)) {
audit_mark = ERR_PTR(-ENOMEM);
goto out;

View file

@ -139,7 +139,7 @@ static struct audit_parent *audit_init_parent(const struct path *path)
struct audit_parent *parent;
int ret;
parent = kzalloc_obj(*parent, GFP_KERNEL);
parent = kzalloc_obj(*parent);
if (unlikely(!parent))
return ERR_PTR(-ENOMEM);
@ -161,7 +161,7 @@ static struct audit_watch *audit_init_watch(char *path)
{
struct audit_watch *watch;
watch = kzalloc_obj(*watch, GFP_KERNEL);
watch = kzalloc_obj(*watch);
if (unlikely(!watch))
return ERR_PTR(-ENOMEM);

View file

@ -108,11 +108,11 @@ static inline struct audit_entry *audit_init_entry(u32 field_count)
struct audit_entry *entry;
struct audit_field *fields;
entry = kzalloc_obj(*entry, GFP_KERNEL);
entry = kzalloc_obj(*entry);
if (unlikely(!entry))
return NULL;
fields = kzalloc_objs(*fields, field_count, GFP_KERNEL);
fields = kzalloc_objs(*fields, field_count);
if (unlikely(!fields)) {
kfree(entry);
return NULL;
@ -1180,7 +1180,7 @@ int audit_list_rules_send(struct sk_buff *request_skb, int seq)
* happen if we're actually running in the context of auditctl
* trying to _send_ the stuff */
dest = kmalloc_obj(*dest, GFP_KERNEL);
dest = kmalloc_obj(*dest);
if (!dest)
return -ENOMEM;
dest->net = get_net(sock_net(NETLINK_CB(request_skb).sk));

View file

@ -255,7 +255,7 @@ static int grow_tree_refs(struct audit_context *ctx)
{
struct audit_tree_refs *p = ctx->trees;
ctx->trees = kzalloc_obj(struct audit_tree_refs, GFP_KERNEL);
ctx->trees = kzalloc_obj(struct audit_tree_refs);
if (!ctx->trees) {
ctx->trees = p;
return 0;
@ -1032,7 +1032,7 @@ static inline struct audit_context *audit_alloc_context(enum audit_state state)
{
struct audit_context *context;
context = kzalloc_obj(*context, GFP_KERNEL);
context = kzalloc_obj(*context);
if (!context)
return NULL;
context->context = AUDIT_CTX_UNUSED;
@ -2650,7 +2650,7 @@ int __audit_sockaddr(int len, void *a)
struct audit_context *context = audit_context();
if (!context->sockaddr) {
void *p = kmalloc_obj(struct sockaddr_storage, GFP_KERNEL);
void *p = kmalloc_obj(struct sockaddr_storage);
if (!p)
return -ENOMEM;
@ -2743,7 +2743,7 @@ int __audit_log_bprm_fcaps(struct linux_binprm *bprm,
struct audit_context *context = audit_context();
struct cpu_vfs_cap_data vcaps;
ax = kmalloc_obj(*ax, GFP_KERNEL);
ax = kmalloc_obj(*ax);
if (!ax)
return -ENOMEM;

View file

@ -324,7 +324,7 @@ static int remember_vma(struct bpf_arena *arena, struct vm_area_struct *vma)
{
struct vma_list *vml;
vml = kmalloc_obj(*vml, GFP_KERNEL);
vml = kmalloc_obj(*vml);
if (!vml)
return -ENOMEM;
refcount_set(&vml->mmap_count, 1);

View file

@ -1061,7 +1061,7 @@ static int prog_array_map_poke_track(struct bpf_map *map,
goto out;
}
elem = kmalloc_obj(*elem, GFP_KERNEL);
elem = kmalloc_obj(*elem);
if (!elem) {
ret = -ENOMEM;
goto out;
@ -1237,7 +1237,7 @@ static struct bpf_event_entry *bpf_event_entry_gen(struct file *perf_file,
{
struct bpf_event_entry *ee;
ee = kzalloc_obj(*ee, GFP_KERNEL);
ee = kzalloc_obj(*ee);
if (ee) {
ee->event = perf_file->private_data;
ee->perf_file = perf_file;

View file

@ -295,7 +295,7 @@ int bpf_iter_reg_target(const struct bpf_iter_reg *reg_info)
{
struct bpf_iter_target_info *tinfo;
tinfo = kzalloc_obj(*tinfo, GFP_KERNEL);
tinfo = kzalloc_obj(*tinfo);
if (!tinfo)
return -ENOMEM;

View file

@ -218,7 +218,7 @@ static int prepare_arg_info(struct btf *btf,
args = btf_params(func_proto);
stub_args = btf_params(stub_func_proto);
info_buf = kzalloc_objs(*info_buf, nargs, GFP_KERNEL);
info_buf = kzalloc_objs(*info_buf, nargs);
if (!info_buf)
return -ENOMEM;
@ -378,7 +378,7 @@ int bpf_struct_ops_desc_init(struct bpf_struct_ops_desc *st_ops_desc,
if (!is_valid_value_type(btf, value_id, t, value_name))
return -EINVAL;
arg_info = kzalloc_objs(*arg_info, btf_type_vlen(t), GFP_KERNEL);
arg_info = kzalloc_objs(*arg_info, btf_type_vlen(t));
if (!arg_info)
return -ENOMEM;
@ -720,7 +720,7 @@ static long bpf_struct_ops_map_update_elem(struct bpf_map *map, void *key,
if (uvalue->common.state || refcount_read(&uvalue->common.refcnt))
return -EINVAL;
tlinks = kzalloc_objs(*tlinks, BPF_TRAMP_MAX, GFP_KERNEL);
tlinks = kzalloc_objs(*tlinks, BPF_TRAMP_MAX);
if (!tlinks)
return -ENOMEM;

View file

@ -8306,7 +8306,7 @@ static int btf_module_notify(struct notifier_block *nb, unsigned long op,
switch (op) {
case MODULE_STATE_COMING:
btf_mod = kzalloc_obj(*btf_mod, GFP_KERNEL);
btf_mod = kzalloc_obj(*btf_mod);
if (!btf_mod) {
err = -ENOMEM;
goto out;
@ -8341,7 +8341,7 @@ static int btf_module_notify(struct notifier_block *nb, unsigned long op,
if (IS_ENABLED(CONFIG_SYSFS)) {
struct bin_attribute *attr;
attr = kzalloc_obj(*attr, GFP_KERNEL);
attr = kzalloc_obj(*attr);
if (!attr)
goto out;

View file

@ -845,7 +845,7 @@ static int __cgroup_bpf_attach(struct cgroup *cgrp,
if (pl) {
old_prog = pl->prog;
} else {
pl = kmalloc_obj(*pl, GFP_KERNEL);
pl = kmalloc_obj(*pl);
if (!pl) {
bpf_cgroup_storages_free(new_storage);
return -ENOMEM;

View file

@ -68,7 +68,7 @@ int bpf_crypto_register_type(const struct bpf_crypto_type *type)
goto unlock;
}
node = kmalloc_obj(*node, GFP_KERNEL);
node = kmalloc_obj(*node);
err = -ENOMEM;
if (!node)
goto unlock;
@ -176,7 +176,7 @@ bpf_crypto_ctx_create(const struct bpf_crypto_params *params, u32 params__sz,
goto err_module_put;
}
ctx = kzalloc_obj(*ctx, GFP_KERNEL);
ctx = kzalloc_obj(*ctx);
if (!ctx) {
*err = -ENOMEM;
goto err_module_put;

View file

@ -3993,7 +3993,7 @@ __bpf_kfunc struct bpf_key *bpf_lookup_user_key(s32 serial, u64 flags)
if (IS_ERR(key_ref))
return NULL;
bkey = kmalloc_obj(*bkey, GFP_KERNEL);
bkey = kmalloc_obj(*bkey);
if (!bkey) {
key_put(key_ref_to_ptr(key_ref));
return NULL;

View file

@ -1044,7 +1044,7 @@ static int bpf_init_fs_context(struct fs_context *fc)
{
struct bpf_mount_opts *opts;
opts = kzalloc_obj(struct bpf_mount_opts, GFP_KERNEL);
opts = kzalloc_obj(struct bpf_mount_opts);
if (!opts)
return -ENOMEM;

View file

@ -72,7 +72,7 @@ static int __bpf_offload_dev_netdev_register(struct bpf_offload_dev *offdev,
struct bpf_offload_netdev *ondev;
int err;
ondev = kzalloc_obj(*ondev, GFP_KERNEL);
ondev = kzalloc_obj(*ondev);
if (!ondev)
return -ENOMEM;
@ -777,7 +777,7 @@ bpf_offload_dev_create(const struct bpf_prog_offload_ops *ops, void *priv)
{
struct bpf_offload_dev *offdev;
offdev = kzalloc_obj(*offdev, GFP_KERNEL);
offdev = kzalloc_obj(*offdev);
if (!offdev)
return ERR_PTR(-ENOMEM);

View file

@ -256,7 +256,7 @@ static int direct_ops_mod(struct bpf_trampoline *tr, void *addr, bool lock_direc
*/
static int direct_ops_alloc(struct bpf_trampoline *tr)
{
tr->fops = kzalloc_obj(struct ftrace_ops, GFP_KERNEL);
tr->fops = kzalloc_obj(struct ftrace_ops);
if (!tr->fops)
return -ENOMEM;
tr->fops->private = tr;
@ -342,7 +342,7 @@ static struct bpf_trampoline *bpf_trampoline_lookup(u64 key, unsigned long ip)
goto out;
}
}
tr = kzalloc_obj(*tr, GFP_KERNEL);
tr = kzalloc_obj(*tr);
if (!tr)
goto out;
if (direct_ops_alloc(tr)) {
@ -446,7 +446,7 @@ bpf_trampoline_get_progs(const struct bpf_trampoline *tr, int *total, bool *ip_a
int kind;
*total = 0;
tlinks = kzalloc_objs(*tlinks, BPF_TRAMP_MAX, GFP_KERNEL);
tlinks = kzalloc_objs(*tlinks, BPF_TRAMP_MAX);
if (!tlinks)
return ERR_PTR(-ENOMEM);
@ -569,7 +569,7 @@ static struct bpf_tramp_image *bpf_tramp_image_alloc(u64 key, int size)
void *image;
int err = -ENOMEM;
im = kzalloc_obj(*im, GFP_KERNEL);
im = kzalloc_obj(*im);
if (!im)
goto out;

View file

@ -22769,7 +22769,7 @@ static int jit_subprogs(struct bpf_verifier_env *env)
goto out_undo_insn;
err = -ENOMEM;
func = kzalloc_objs(prog, env->subprog_cnt, GFP_KERNEL);
func = kzalloc_objs(prog, env->subprog_cnt);
if (!func)
goto out_undo_insn;

View file

@ -317,7 +317,7 @@ static struct cgroup_pidlist *cgroup_pidlist_find_create(struct cgroup *cgrp,
return l;
/* entry not found; create a new one */
l = kzalloc_obj(struct cgroup_pidlist, GFP_KERNEL);
l = kzalloc_obj(struct cgroup_pidlist);
if (!l)
return l;
@ -352,7 +352,7 @@ static int pidlist_array_load(struct cgroup *cgrp, enum cgroup_filetype type,
* show up until sometime later on.
*/
length = cgroup_task_count(cgrp);
array = kvmalloc_objs(pid_t, length, GFP_KERNEL);
array = kvmalloc_objs(pid_t, length);
if (!array)
return -ENOMEM;
/* now, populate the array */
@ -1237,7 +1237,7 @@ static int cgroup1_root_to_use(struct fs_context *fc)
if (ctx->ns != &init_cgroup_ns)
return -EPERM;
root = kzalloc_obj(*root, GFP_KERNEL);
root = kzalloc_obj(*root);
if (!root)
return -ENOMEM;

View file

@ -1168,7 +1168,7 @@ static int allocate_cgrp_cset_links(int count, struct list_head *tmp_links)
INIT_LIST_HEAD(tmp_links);
for (i = 0; i < count; i++) {
link = kzalloc_obj(*link, GFP_KERNEL);
link = kzalloc_obj(*link);
if (!link) {
free_cgrp_cset_links(tmp_links);
return -ENOMEM;
@ -1241,7 +1241,7 @@ static struct css_set *find_css_set(struct css_set *old_cset,
if (cset)
return cset;
cset = kzalloc_obj(*cset, GFP_KERNEL);
cset = kzalloc_obj(*cset);
if (!cset)
return NULL;
@ -2350,7 +2350,7 @@ static int cgroup_init_fs_context(struct fs_context *fc)
{
struct cgroup_fs_context *ctx;
ctx = kzalloc_obj(struct cgroup_fs_context, GFP_KERNEL);
ctx = kzalloc_obj(struct cgroup_fs_context);
if (!ctx)
return -ENOMEM;
@ -4251,7 +4251,7 @@ static int cgroup_file_open(struct kernfs_open_file *of)
struct cgroup_file_ctx *ctx;
int ret;
ctx = kzalloc_obj(*ctx, GFP_KERNEL);
ctx = kzalloc_obj(*ctx);
if (!ctx)
return -ENOMEM;

View file

@ -316,7 +316,7 @@ void cpuset1_hotplug_update_tasks(struct cpuset *cs,
css_tryget_online(&cs->css)) {
struct cpuset_remove_tasks_struct *s;
s = kzalloc_obj(*s, GFP_KERNEL);
s = kzalloc_obj(*s);
if (WARN_ON_ONCE(!s)) {
css_put(&cs->css);
return;
@ -653,7 +653,7 @@ int cpuset1_generate_sched_domains(cpumask_var_t **domains,
if (!doms)
goto done;
dattr = kmalloc_obj(struct sched_domain_attr, GFP_KERNEL);
dattr = kmalloc_obj(struct sched_domain_attr);
if (dattr) {
*dattr = SD_ATTR_INIT;
update_domain_attr_tree(dattr, &top_cpuset);
@ -664,7 +664,7 @@ int cpuset1_generate_sched_domains(cpumask_var_t **domains,
goto done;
}
csa = kmalloc_objs(cp, nr_cpusets(), GFP_KERNEL);
csa = kmalloc_objs(cp, nr_cpusets());
if (!csa)
goto done;
csn = 0;
@ -727,7 +727,7 @@ int cpuset1_generate_sched_domains(cpumask_var_t **domains,
* The rest of the code, including the scheduler, can deal with
* dattr==NULL case. No need to abort if alloc fails.
*/
dattr = kmalloc_objs(struct sched_domain_attr, ndoms, GFP_KERNEL);
dattr = kmalloc_objs(struct sched_domain_attr, ndoms);
for (nslot = 0, i = 0; i < csn; i++) {
nslot_update = 0;

View file

@ -536,7 +536,7 @@ static struct cpuset *dup_or_alloc_cpuset(struct cpuset *cs)
/* Allocate base structure */
trial = cs ? kmemdup(cs, sizeof(*cs), GFP_KERNEL) :
kzalloc_obj(*cs, GFP_KERNEL);
kzalloc_obj(*cs);
if (!trial)
return NULL;
@ -791,7 +791,7 @@ static int generate_sched_domains(cpumask_var_t **domains,
goto generate_doms;
}
csa = kmalloc_objs(cp, nr_cpusets(), GFP_KERNEL);
csa = kmalloc_objs(cp, nr_cpusets());
if (!csa)
goto done;
@ -835,7 +835,7 @@ generate_doms:
* The rest of the code, including the scheduler, can deal with
* dattr==NULL case. No need to abort if alloc fails.
*/
dattr = kmalloc_objs(struct sched_domain_attr, ndoms, GFP_KERNEL);
dattr = kmalloc_objs(struct sched_domain_attr, ndoms);
/*
* Cgroup v2 doesn't support domain attributes, just set all of them
@ -2478,7 +2478,7 @@ static void cpuset_migrate_mm(struct mm_struct *mm, const nodemask_t *from,
return;
}
mwork = kzalloc_obj(*mwork, GFP_KERNEL);
mwork = kzalloc_obj(*mwork);
if (mwork) {
mwork->mm = mm;
mwork->from = *from;
@ -2500,7 +2500,7 @@ static void schedule_flush_migrate_mm(void)
{
struct callback_head *flush_cb;
flush_cb = kzalloc_obj(struct callback_head, GFP_KERNEL);
flush_cb = kzalloc_obj(struct callback_head);
if (!flush_cb)
return;

View file

@ -14,7 +14,7 @@
static struct cgroup_subsys_state *
debug_css_alloc(struct cgroup_subsys_state *parent_css)
{
struct cgroup_subsys_state *css = kzalloc_obj(*css, GFP_KERNEL);
struct cgroup_subsys_state *css = kzalloc_obj(*css);
if (!css)
return ERR_PTR(-ENOMEM);

View file

@ -222,7 +222,7 @@ static void dmemcs_free(struct cgroup_subsys_state *css)
static struct cgroup_subsys_state *
dmemcs_alloc(struct cgroup_subsys_state *parent_css)
{
struct dmemcg_state *dmemcs = kzalloc_obj(*dmemcs, GFP_KERNEL);
struct dmemcg_state *dmemcs = kzalloc_obj(*dmemcs);
if (!dmemcs)
return ERR_PTR(-ENOMEM);
@ -521,7 +521,7 @@ struct dmem_cgroup_region *dmem_cgroup_register_region(u64 size, const char *fmt
if (!region_name)
return ERR_PTR(-ENOMEM);
ret = kzalloc_obj(*ret, GFP_KERNEL);
ret = kzalloc_obj(*ret);
if (!ret) {
kfree(region_name);
return ERR_PTR(-ENOMEM);
@ -597,7 +597,7 @@ get_cg_pool_unlocked(struct dmemcg_state *cg, struct dmem_cgroup_region *region)
if (WARN_ON(allocpool))
continue;
allocpool = kzalloc_obj(*allocpool, GFP_KERNEL);
allocpool = kzalloc_obj(*allocpool);
if (allocpool) {
pool = NULL;
continue;

View file

@ -81,7 +81,7 @@ freezer_css_alloc(struct cgroup_subsys_state *parent_css)
{
struct freezer *freezer;
freezer = kzalloc_obj(struct freezer, GFP_KERNEL);
freezer = kzalloc_obj(struct freezer);
if (!freezer)
return ERR_PTR(-ENOMEM);

View file

@ -445,7 +445,7 @@ misc_cg_alloc(struct cgroup_subsys_state *parent_css)
if (!parent_css) {
cg = &root_cg;
} else {
cg = kzalloc_obj(*cg, GFP_KERNEL);
cg = kzalloc_obj(*cg);
if (!cg)
return ERR_PTR(-ENOMEM);
}

View file

@ -80,7 +80,7 @@ pids_css_alloc(struct cgroup_subsys_state *parent)
{
struct pids_cgroup *pids;
pids = kzalloc_obj(struct pids_cgroup, GFP_KERNEL);
pids = kzalloc_obj(struct pids_cgroup);
if (!pids)
return ERR_PTR(-ENOMEM);

View file

@ -134,7 +134,7 @@ get_cg_rpool_locked(struct rdma_cgroup *cg, struct rdmacg_device *device)
if (rpool)
return rpool;
rpool = kzalloc_obj(*rpool, GFP_KERNEL);
rpool = kzalloc_obj(*rpool);
if (!rpool)
return ERR_PTR(-ENOMEM);
@ -443,7 +443,7 @@ static ssize_t rdmacg_resource_set_max(struct kernfs_open_file *of,
goto err;
}
new_limits = kzalloc_objs(int, RDMACG_RESOURCE_MAX, GFP_KERNEL);
new_limits = kzalloc_objs(int, RDMACG_RESOURCE_MAX);
if (!new_limits) {
ret = -ENOMEM;
goto err;
@ -566,7 +566,7 @@ rdmacg_css_alloc(struct cgroup_subsys_state *parent)
{
struct rdma_cgroup *cg;
cg = kzalloc_obj(*cg, GFP_KERNEL);
cg = kzalloc_obj(*cg);
if (!cg)
return ERR_PTR(-ENOMEM);

View file

@ -368,7 +368,7 @@ static int __crash_shrink_memory(struct resource *old_res,
{
struct resource *ram_res;
ram_res = kzalloc_obj(*ram_res, GFP_KERNEL);
ram_res = kzalloc_obj(*ram_res);
if (!ram_res)
return -ENOMEM;

View file

@ -252,7 +252,7 @@ static struct config_item *config_keys_make_item(struct config_group *group,
return ERR_PTR(-EINVAL);
}
config_key = kzalloc_obj(struct config_key, GFP_KERNEL);
config_key = kzalloc_obj(struct config_key);
if (!config_key)
return ERR_PTR(-ENOMEM);

View file

@ -49,7 +49,7 @@ static struct dma_coherent_mem *dma_init_coherent_memory(phys_addr_t phys_addr,
if (!mem_base)
return ERR_PTR(-EINVAL);
dma_mem = kzalloc_obj(struct dma_coherent_mem, GFP_KERNEL);
dma_mem = kzalloc_obj(struct dma_coherent_mem);
if (!dma_mem)
goto out_unmap_membase;
dma_mem->bitmap = bitmap_zalloc(pages, GFP_KERNEL);

View file

@ -900,7 +900,7 @@ void dma_debug_add_bus(const struct bus_type *bus)
if (dma_debug_disabled())
return;
nb = kzalloc_obj(struct notifier_block, GFP_KERNEL);
nb = kzalloc_obj(struct notifier_block);
if (nb == NULL) {
pr_err("dma_debug_add_bus: out of memory\n");
return;

View file

@ -654,7 +654,7 @@ int dma_direct_set_offset(struct device *dev, phys_addr_t cpu_start,
if (!offset)
return 0;
map = kzalloc_objs(*map, 2, GFP_KERNEL);
map = kzalloc_objs(*map, 2);
if (!map)
return -ENOMEM;
map[0].cpu_start = cpu_start;

View file

@ -121,7 +121,7 @@ static int do_map_benchmark(struct map_benchmark_data *map)
int ret = 0;
int i;
tsk = kmalloc_objs(*tsk, threads, GFP_KERNEL);
tsk = kmalloc_objs(*tsk, threads);
if (!tsk)
return -ENOMEM;

View file

@ -45,7 +45,7 @@ void *dma_common_contiguous_remap(struct page *page, size_t size,
void *vaddr;
int i;
pages = kvmalloc_objs(struct page *, count, GFP_KERNEL);
pages = kvmalloc_objs(struct page *, count);
if (!pages)
return NULL;
for (i = 0; i < count; i++)

View file

@ -1809,18 +1809,18 @@ static int rmem_swiotlb_device_init(struct reserved_mem *rmem,
if (!mem) {
struct io_tlb_pool *pool;
mem = kzalloc_obj(*mem, GFP_KERNEL);
mem = kzalloc_obj(*mem);
if (!mem)
return -ENOMEM;
pool = &mem->defpool;
pool->slots = kzalloc_objs(*pool->slots, nslabs, GFP_KERNEL);
pool->slots = kzalloc_objs(*pool->slots, nslabs);
if (!pool->slots) {
kfree(mem);
return -ENOMEM;
}
pool->areas = kzalloc_objs(*pool->areas, nareas, GFP_KERNEL);
pool->areas = kzalloc_objs(*pool->areas, nareas);
if (!pool->areas) {
kfree(pool->slots);
kfree(mem);

View file

@ -5058,7 +5058,7 @@ alloc_perf_context(struct task_struct *task)
{
struct perf_event_context *ctx;
ctx = kzalloc_obj(struct perf_event_context, GFP_KERNEL);
ctx = kzalloc_obj(struct perf_event_context);
if (!ctx)
return NULL;
@ -5198,7 +5198,7 @@ find_get_pmu_context(struct pmu *pmu, struct perf_event_context *ctx,
return epc;
}
new = kzalloc_obj(*epc, GFP_KERNEL);
new = kzalloc_obj(*epc);
if (!new)
return ERR_PTR(-ENOMEM);
@ -5374,7 +5374,7 @@ alloc_perf_ctx_data(struct kmem_cache *ctx_cache, bool global)
{
struct perf_ctx_data *cd;
cd = kzalloc_obj(*cd, GFP_KERNEL);
cd = kzalloc_obj(*cd);
if (!cd)
return NULL;
@ -11111,7 +11111,7 @@ static int swevent_hlist_get_cpu(int cpu)
cpumask_test_cpu(cpu, perf_online_mask)) {
struct swevent_hlist *hlist;
hlist = kzalloc_obj(*hlist, GFP_KERNEL);
hlist = kzalloc_obj(*hlist);
if (!hlist) {
err = -ENOMEM;
goto exit;
@ -12634,7 +12634,7 @@ static int pmu_dev_alloc(struct pmu *pmu)
{
int ret = -ENOMEM;
pmu->dev = kzalloc_obj(struct device, GFP_KERNEL);
pmu->dev = kzalloc_obj(struct device);
if (!pmu->dev)
goto out;
@ -15269,7 +15269,7 @@ perf_cgroup_css_alloc(struct cgroup_subsys_state *parent_css)
{
struct perf_cgroup *jc;
jc = kzalloc_obj(*jc, GFP_KERNEL);
jc = kzalloc_obj(*jc);
if (!jc)
return ERR_PTR(-ENOMEM);

View file

@ -238,7 +238,7 @@ static int delayed_uprobe_add(struct uprobe *uprobe, struct mm_struct *mm)
if (delayed_uprobe_check(uprobe, mm))
return 0;
du = kzalloc_obj(*du, GFP_KERNEL);
du = kzalloc_obj(*du);
if (!du)
return -ENOMEM;
@ -994,7 +994,7 @@ static struct uprobe *alloc_uprobe(struct inode *inode, loff_t offset,
{
struct uprobe *uprobe, *cur_uprobe;
uprobe = kzalloc_obj(struct uprobe, GFP_KERNEL);
uprobe = kzalloc_obj(struct uprobe);
if (!uprobe)
return ERR_PTR(-ENOMEM);
@ -1252,7 +1252,7 @@ build_map_info(struct address_space *mapping, loff_t offset, bool is_register)
}
do {
info = kmalloc_obj(struct map_info, GFP_KERNEL);
info = kmalloc_obj(struct map_info);
if (!info) {
curr = ERR_PTR(-ENOMEM);
goto out;
@ -1755,7 +1755,7 @@ static struct xol_area *__create_xol_area(unsigned long vaddr)
struct xol_area *area;
void *insns;
area = kzalloc_obj(*area, GFP_KERNEL);
area = kzalloc_obj(*area);
if (unlikely(!area))
goto out;
@ -2069,7 +2069,7 @@ static struct uprobe_task *alloc_utask(void)
{
struct uprobe_task *utask;
utask = kzalloc_obj(*utask, GFP_KERNEL);
utask = kzalloc_obj(*utask);
if (!utask)
return NULL;
@ -2102,7 +2102,7 @@ static struct return_instance *alloc_return_instance(struct uprobe_task *utask)
if (ri)
return ri;
ri = kzalloc_obj(*ri, GFP_KERNEL);
ri = kzalloc_obj(*ri);
if (!ri)
return ZERO_SIZE_PTR;

View file

@ -57,7 +57,7 @@ static struct fei_attr *fei_attr_new(const char *sym, unsigned long addr)
{
struct fei_attr *attr;
attr = kzalloc_obj(*attr, GFP_KERNEL);
attr = kzalloc_obj(*attr);
if (attr) {
attr->kp.symbol_name = kstrdup(sym, GFP_KERNEL);
if (!attr->kp.symbol_name) {

View file

@ -17,7 +17,7 @@ int refill_pi_state_cache(void)
if (likely(current->pi_state_cache))
return 0;
pi_state = kzalloc_obj(*pi_state, GFP_KERNEL);
pi_state = kzalloc_obj(*pi_state);
if (!pi_state)
return -ENOMEM;

View file

@ -333,7 +333,7 @@ SYSCALL_DEFINE5(futex_waitv, struct futex_waitv __user *, waiters,
if (timeout && (ret = futex2_setup_timeout(timeout, clockid, &to)))
return ret;
futexv = kzalloc_objs(*futexv, nr_futexes, GFP_KERNEL);
futexv = kzalloc_objs(*futexv, nr_futexes);
if (!futexv) {
ret = -ENOMEM;
goto destroy_timer;

View file

@ -81,7 +81,7 @@ static LIST_HEAD(clang_gcov_list);
void llvm_gcov_init(llvm_gcov_callback writeout, llvm_gcov_callback flush)
{
struct gcov_info *info = kzalloc_obj(*info, GFP_KERNEL);
struct gcov_info *info = kzalloc_obj(*info);
if (!info)
return;
@ -112,7 +112,7 @@ EXPORT_SYMBOL(llvm_gcda_start_file);
void llvm_gcda_emit_function(u32 ident, u32 func_checksum, u32 cfg_checksum)
{
struct gcov_fn_info *info = kzalloc_obj(*info, GFP_KERNEL);
struct gcov_fn_info *info = kzalloc_obj(*info);
if (!info)
return;

View file

@ -482,7 +482,7 @@ static void add_links(struct gcov_node *node, struct dentry *parent)
for (num = 0; gcov_link[num].ext; num++)
/* Nothing. */;
node->links = kzalloc_objs(struct dentry *, num, GFP_KERNEL);
node->links = kzalloc_objs(struct dentry *, num);
if (!node->links)
return;
for (i = 0; i < num; i++) {
@ -731,7 +731,7 @@ static void add_info(struct gcov_node *node, struct gcov_info *info)
* case the new data set is incompatible, the node only contains
* unloaded data sets and there's not enough memory for the array.
*/
loaded_info = kzalloc_objs(struct gcov_info *, num + 1, GFP_KERNEL);
loaded_info = kzalloc_objs(struct gcov_info *, num + 1);
if (!loaded_info) {
pr_warn("could not add '%s' (out of memory)\n",
gcov_info_filename(info));

View file

@ -56,7 +56,7 @@ irq_create_affinity_masks(unsigned int nvecs, struct irq_affinity *affd)
if (!affvecs)
return NULL;
masks = kzalloc_objs(*masks, nvecs, GFP_KERNEL);
masks = kzalloc_objs(*masks, nvecs);
if (!masks)
return NULL;

View file

@ -148,7 +148,7 @@ static int irq_sim_domain_map(struct irq_domain *domain,
struct irq_sim_work_ctx *work_ctx = domain->host_data;
struct irq_sim_irq_ctx *irq_ctx;
irq_ctx = kzalloc_obj(*irq_ctx, GFP_KERNEL);
irq_ctx = kzalloc_obj(*irq_ctx);
if (!irq_ctx)
return -ENOMEM;
@ -202,7 +202,7 @@ struct irq_domain *irq_domain_create_sim_full(struct fwnode_handle *fwnode,
void *data)
{
struct irq_sim_work_ctx *work_ctx __free(kfree) =
kzalloc_obj(*work_ctx, GFP_KERNEL);
kzalloc_obj(*work_ctx);
if (!work_ctx)
return ERR_PTR(-ENOMEM);

View file

@ -969,7 +969,7 @@ int irq_set_percpu_devid(unsigned int irq)
if (!desc || desc->percpu_enabled)
return -EINVAL;
desc->percpu_enabled = kzalloc_obj(*desc->percpu_enabled, GFP_KERNEL);
desc->percpu_enabled = kzalloc_obj(*desc->percpu_enabled);
if (!desc->percpu_enabled)
return -ENOMEM;

View file

@ -92,7 +92,7 @@ struct fwnode_handle *__irq_domain_alloc_fwnode(unsigned int type, int id,
struct irqchip_fwid *fwid;
char *n;
fwid = kzalloc_obj(*fwid, GFP_KERNEL);
fwid = kzalloc_obj(*fwid);
switch (type) {
case IRQCHIP_FWNODE_NAMED:

View file

@ -1332,7 +1332,7 @@ static int irq_setup_forced_threading(struct irqaction *new)
*/
if (new->handler && new->thread_fn) {
/* Allocate the secondary action */
new->secondary = kzalloc_obj(struct irqaction, GFP_KERNEL);
new->secondary = kzalloc_obj(struct irqaction);
if (!new->secondary)
return -ENOMEM;
new->secondary->handler = irq_forced_secondary_handler;
@ -2156,7 +2156,7 @@ int request_threaded_irq(unsigned int irq, irq_handler_t handler,
handler = irq_default_primary_handler;
}
action = kzalloc_obj(struct irqaction, GFP_KERNEL);
action = kzalloc_obj(struct irqaction);
if (!action)
return -ENOMEM;
@ -2486,7 +2486,7 @@ struct irqaction *create_percpu_irqaction(irq_handler_t handler, unsigned long f
if (!affinity)
affinity = cpu_possible_mask;
action = kzalloc_obj(struct irqaction, GFP_KERNEL);
action = kzalloc_obj(struct irqaction);
if (!action)
return NULL;

View file

@ -76,7 +76,7 @@ static int msi_domain_prepare_irqs(struct irq_domain *domain, struct device *dev
static struct msi_desc *msi_alloc_desc(struct device *dev, int nvec,
const struct irq_affinity_desc *affinity)
{
struct msi_desc *desc = kzalloc_obj(*desc, GFP_KERNEL);
struct msi_desc *desc = kzalloc_obj(*desc);
if (!desc)
return NULL;
@ -530,7 +530,7 @@ static int msi_sysfs_populate_desc(struct device *dev, struct msi_desc *desc)
struct device_attribute *attrs;
int ret, i;
attrs = kzalloc_objs(*attrs, desc->nvec_used, GFP_KERNEL);
attrs = kzalloc_objs(*attrs, desc->nvec_used);
if (!attrs)
return -ENOMEM;

View file

@ -264,7 +264,7 @@ static int test_kallsyms_basic_function(void)
char namebuf[KSYM_NAME_LEN];
struct test_stat *stat, *stat2;
stat = kmalloc_objs(*stat, 2, GFP_KERNEL);
stat = kmalloc_objs(*stat, 2);
if (!stat)
return -ENOMEM;
stat2 = stat + 1;

View file

@ -527,7 +527,7 @@ static int kcov_open(struct inode *inode, struct file *filep)
{
struct kcov *kcov;
kcov = kzalloc_obj(*kcov, GFP_KERNEL);
kcov = kzalloc_obj(*kcov);
if (!kcov)
return -ENOMEM;
guard(spinlock_init)(&kcov->lock);

View file

@ -168,7 +168,7 @@ static bool __report_matches(const struct expect_report *r)
if (!report_available())
return false;
expect = kmalloc_obj(observed.lines, GFP_KERNEL);
expect = kmalloc_obj(observed.lines);
if (WARN_ON(!expect))
return false;
@ -1538,7 +1538,7 @@ static int test_init(struct kunit *test)
if (WARN_ON(!nthreads))
goto err;
threads = kzalloc_objs(struct task_struct *, nthreads + 1, GFP_KERNEL);
threads = kzalloc_objs(struct task_struct *, nthreads + 1);
if (WARN_ON(!threads))
goto err;

View file

@ -284,7 +284,7 @@ COMPAT_SYSCALL_DEFINE4(kexec_load, compat_ulong_t, entry,
if ((flags & KEXEC_ARCH_MASK) == KEXEC_ARCH_DEFAULT)
return -EINVAL;
ksegments = kmalloc_objs(ksegments[0], nr_segments, GFP_KERNEL);
ksegments = kmalloc_objs(ksegments[0], nr_segments);
if (!ksegments)
return -ENOMEM;

View file

@ -231,7 +231,7 @@ struct kimage *do_kimage_alloc_init(void)
struct kimage *image;
/* Allocate a controlling structure */
image = kzalloc_obj(*image, GFP_KERNEL);
image = kzalloc_obj(*image);
if (!image)
return NULL;
@ -975,7 +975,7 @@ void *kimage_map_segment(struct kimage *image, int idx)
* Collect the source pages and map them in a contiguous VA range.
*/
npages = PFN_UP(eaddr) - PFN_DOWN(addr);
src_pages = kmalloc_objs(*src_pages, npages, GFP_KERNEL);
src_pages = kmalloc_objs(*src_pages, npages);
if (!src_pages) {
pr_err("Could not allocate ima pages array.\n");
return NULL;

View file

@ -900,7 +900,7 @@ static struct kprobe *alloc_aggr_kprobe(struct kprobe *p)
{
struct optimized_kprobe *op;
op = kzalloc_obj(struct optimized_kprobe, GFP_KERNEL);
op = kzalloc_obj(struct optimized_kprobe);
if (!op)
return NULL;
@ -1117,7 +1117,7 @@ static void free_aggr_kprobe(struct kprobe *p)
static struct kprobe *alloc_aggr_kprobe(struct kprobe *p)
{
return kzalloc_obj(struct kprobe, GFP_KERNEL);
return kzalloc_obj(struct kprobe);
}
#endif /* CONFIG_OPTPROBES */
@ -2295,7 +2295,7 @@ int register_kretprobe(struct kretprobe *rp)
rp->rh = NULL;
}
#else /* !CONFIG_KRETPROBE_ON_RETHOOK */
rp->rph = kzalloc_obj(struct kretprobe_holder, GFP_KERNEL);
rp->rph = kzalloc_obj(struct kretprobe_holder);
if (!rp->rph)
return -ENOMEM;
@ -2499,7 +2499,7 @@ int kprobe_add_ksym_blacklist(unsigned long entry)
!kallsyms_lookup_size_offset(entry, &size, &offset))
return -EINVAL;
ent = kmalloc_obj(*ent, GFP_KERNEL);
ent = kmalloc_obj(*ent);
if (!ent)
return -ENOMEM;
ent->start_addr = entry;

View file

@ -122,7 +122,7 @@ bool set_kthread_struct(struct task_struct *p)
if (WARN_ON_ONCE(to_kthread(p)))
return false;
kthread = kzalloc_obj(*kthread, GFP_KERNEL);
kthread = kzalloc_obj(*kthread);
if (!kthread)
return false;
@ -511,7 +511,7 @@ struct task_struct *__kthread_create_on_node(int (*threadfn)(void *data),
{
DECLARE_COMPLETION_ONSTACK(done);
struct task_struct *task;
struct kthread_create_info *create = kmalloc_obj(*create, GFP_KERNEL);
struct kthread_create_info *create = kmalloc_obj(*create);
if (!create)
return ERR_PTR(-ENOMEM);
@ -1083,7 +1083,7 @@ __kthread_create_worker_on_node(unsigned int flags, int node,
struct kthread_worker *worker;
struct task_struct *task;
worker = kzalloc_obj(*worker, GFP_KERNEL);
worker = kzalloc_obj(*worker);
if (!worker)
return ERR_PTR(-ENOMEM);

View file

@ -525,7 +525,7 @@ static struct klp_object *klp_alloc_object_dynamic(const char *name,
{
struct klp_object *obj;
obj = kzalloc_obj(*obj, GFP_KERNEL);
obj = kzalloc_obj(*obj);
if (!obj)
return NULL;
@ -554,7 +554,7 @@ static struct klp_func *klp_alloc_func_nop(struct klp_func *old_func,
{
struct klp_func *func;
func = kzalloc_obj(*func, GFP_KERNEL);
func = kzalloc_obj(*func);
if (!func)
return NULL;

View file

@ -179,7 +179,7 @@ static int klp_patch_func(struct klp_func *func)
return -EINVAL;
}
ops = kzalloc_obj(*ops, GFP_KERNEL);
ops = kzalloc_obj(*ops);
if (!ops)
return -ENOMEM;

View file

@ -187,7 +187,7 @@ static int __kho_preserve_order(struct kho_mem_track *track, unsigned long pfn,
if (!physxa) {
int err;
new_physxa = kzalloc_obj(*physxa, GFP_KERNEL);
new_physxa = kzalloc_obj(*physxa);
if (!new_physxa)
return -ENOMEM;
@ -1090,7 +1090,7 @@ void *kho_restore_vmalloc(const struct kho_vmalloc *preservation)
return NULL;
total_pages = preservation->total_pages;
pages = kvmalloc_objs(*pages, total_pages, GFP_KERNEL);
pages = kvmalloc_objs(*pages, total_pages);
if (!pages)
return NULL;
order = preservation->order;

View file

@ -29,7 +29,7 @@ static int __kho_debugfs_fdt_add(struct list_head *list, struct dentry *dir,
struct fdt_debugfs *f;
struct dentry *file;
f = kmalloc_obj(*f, GFP_KERNEL);
f = kmalloc_obj(*f);
if (!f)
return -ENOMEM;

View file

@ -289,7 +289,7 @@ int luo_preserve_file(struct luo_file_set *file_set, u64 token, int fd)
if (err)
goto err_free_files_mem;
luo_file = kzalloc_obj(*luo_file, GFP_KERNEL);
luo_file = kzalloc_obj(*luo_file);
if (!luo_file) {
err = -ENOMEM;
goto err_flb_unpreserve;
@ -780,7 +780,7 @@ int luo_file_deserialize(struct luo_file_set *file_set,
return -ENOENT;
}
luo_file = kzalloc_obj(*luo_file, GFP_KERNEL);
luo_file = kzalloc_obj(*luo_file);
if (!luo_file)
return -ENOMEM;

View file

@ -343,7 +343,7 @@ int liveupdate_register_flb(struct liveupdate_file_handler *fh,
if (WARN_ON(list_empty(&ACCESS_PRIVATE(fh, list))))
return -EINVAL;
link = kzalloc_obj(*link, GFP_KERNEL);
link = kzalloc_obj(*link);
if (!link)
return -ENOMEM;

View file

@ -119,7 +119,7 @@ static struct luo_session_global luo_session_global = {
static struct luo_session *luo_session_alloc(const char *name)
{
struct luo_session *session = kzalloc_obj(*session, GFP_KERNEL);
struct luo_session *session = kzalloc_obj(*session);
if (!session)
return ERR_PTR(-ENOMEM);

View file

@ -324,7 +324,7 @@ static int __test_cycle(struct ww_class *class, unsigned int nthreads)
unsigned int n, last = nthreads - 1;
int ret;
cycles = kmalloc_objs(*cycles, nthreads, GFP_KERNEL);
cycles = kmalloc_objs(*cycles, nthreads);
if (!cycles)
return -ENOMEM;
@ -412,7 +412,7 @@ static int *get_random_order(int count)
int *order;
int n, r;
order = kmalloc_objs(*order, count, GFP_KERNEL);
order = kmalloc_objs(*order, count);
if (!order)
return order;
@ -506,7 +506,7 @@ static void stress_reorder_work(struct work_struct *work)
return;
for (n = 0; n < stress->nlocks; n++) {
ll = kmalloc_obj(*ll, GFP_KERNEL);
ll = kmalloc_obj(*ll);
if (!ll)
goto out;
@ -582,11 +582,11 @@ static int stress(struct ww_class *class, int nlocks, int nthreads, unsigned int
struct stress *stress_array;
int n, count;
locks = kmalloc_objs(*locks, nlocks, GFP_KERNEL);
locks = kmalloc_objs(*locks, nlocks);
if (!locks)
return -ENOMEM;
stress_array = kmalloc_objs(*stress_array, nthreads, GFP_KERNEL);
stress_array = kmalloc_objs(*stress_array, nthreads);
if (!stress_array) {
kfree(locks);
return -ENOMEM;

View file

@ -125,7 +125,7 @@ bool kmod_dup_request_exists_wait(char *module_name, bool wait, int *dup_ret)
* Pre-allocate the entry in case we have to use it later
* to avoid contention with the mutex.
*/
new_kmod_req = kzalloc_obj(*new_kmod_req, GFP_KERNEL);
new_kmod_req = kzalloc_obj(*new_kmod_req);
if (!new_kmod_req)
return false;

View file

@ -3024,7 +3024,7 @@ static noinline int do_init_module(struct module *mod)
}
#endif
freeinit = kmalloc_obj(*freeinit, GFP_KERNEL);
freeinit = kmalloc_obj(*freeinit);
if (!freeinit) {
ret = -ENOMEM;
goto fail;

View file

@ -250,7 +250,7 @@ int try_add_failed_module(const char *name, enum fail_dup_mod_reason reason)
}
}
mod_fail = kzalloc_obj(*mod_fail, GFP_KERNEL);
mod_fail = kzalloc_obj(*mod_fail);
if (!mod_fail)
return -ENOMEM;
memcpy(mod_fail->name, name, strlen(name));

View file

@ -78,7 +78,7 @@ static int add_sect_attrs(struct module *mod, const struct load_info *info)
if (!sect_attrs)
return -ENOMEM;
gattr = kzalloc_objs(*gattr, nloaded + 1, GFP_KERNEL);
gattr = kzalloc_objs(*gattr, nloaded + 1);
if (!gattr) {
kfree(sect_attrs);
return -ENOMEM;
@ -170,7 +170,7 @@ static int add_notes_attrs(struct module *mod, const struct load_info *info)
if (!notes_attrs)
return -ENOMEM;
gattr = kzalloc_objs(*gattr, notes + 1, GFP_KERNEL);
gattr = kzalloc_objs(*gattr, notes + 1);
if (!gattr) {
kfree(notes_attrs);
return -ENOMEM;

View file

@ -33,7 +33,7 @@ int try_add_tainted_module(struct module *mod)
}
}
mod_taint = kmalloc_obj(*mod_taint, GFP_KERNEL);
mod_taint = kmalloc_obj(*mod_taint);
if (unlikely(!mod_taint))
return -ENOMEM;
strscpy(mod_taint->name, mod->name, MODULE_NAME_LEN);

View file

@ -540,7 +540,7 @@ static struct parallel_data *padata_alloc_pd(struct padata_shell *ps)
struct padata_instance *pinst = ps->pinst;
struct parallel_data *pd;
pd = kzalloc_obj(struct parallel_data, GFP_KERNEL);
pd = kzalloc_obj(struct parallel_data);
if (!pd)
goto err;
@ -952,7 +952,7 @@ struct padata_instance *padata_alloc(const char *name)
{
struct padata_instance *pinst;
pinst = kzalloc_obj(struct padata_instance, GFP_KERNEL);
pinst = kzalloc_obj(struct padata_instance);
if (!pinst)
goto err;
@ -1038,7 +1038,7 @@ struct padata_shell *padata_alloc_shell(struct padata_instance *pinst)
struct parallel_data *pd;
struct padata_shell *ps;
ps = kzalloc_obj(*ps, GFP_KERNEL);
ps = kzalloc_obj(*ps);
if (!ps)
goto out;

View file

@ -633,7 +633,7 @@ static __init_or_module int add_sysfs_param(struct module_kobject *mk,
if (!mk->mp) {
/* First allocation. */
mk->mp = kzalloc_obj(*mk->mp, GFP_KERNEL);
mk->mp = kzalloc_obj(*mk->mp);
if (!mk->mp)
return -ENOMEM;
mk->mp->grp.name = "parameters";
@ -766,7 +766,7 @@ lookup_or_create_module_kobject(const char *name)
if (kobj)
return to_module_kobject(kobj);
mk = kzalloc_obj(struct module_kobject, GFP_KERNEL);
mk = kzalloc_obj(struct module_kobject);
if (!mk)
return NULL;

View file

@ -58,7 +58,7 @@ int pm_vt_switch_required(struct device *dev, bool required)
}
}
entry = kmalloc_obj(*entry, GFP_KERNEL);
entry = kmalloc_obj(*entry);
if (!entry) {
ret = -ENOMEM;
goto out;

View file

@ -439,7 +439,7 @@ static int em_create_pd(struct device *dev, int nr_states,
cpumask_copy(em_span_cpus(pd), cpus);
} else {
pd = kzalloc_obj(*pd, GFP_KERNEL);
pd = kzalloc_obj(*pd);
if (!pd)
return -ENOMEM;
}

View file

@ -341,7 +341,7 @@ static int cpu_latency_qos_open(struct inode *inode, struct file *filp)
{
struct pm_qos_request *req;
req = kzalloc_obj(*req, GFP_KERNEL);
req = kzalloc_obj(*req);
if (!req)
return -ENOMEM;
@ -440,7 +440,7 @@ static int cpu_wakeup_latency_qos_open(struct inode *inode, struct file *filp)
{
struct pm_qos_request *req;
req = kzalloc_obj(*req, GFP_KERNEL);
req = kzalloc_obj(*req);
if (!req)
return -ENOMEM;

View file

@ -1124,7 +1124,7 @@ int create_basic_memory_bitmaps(void)
else
BUG_ON(forbidden_pages_map || free_pages_map);
bm1 = kzalloc_obj(struct memory_bitmap, GFP_KERNEL);
bm1 = kzalloc_obj(struct memory_bitmap);
if (!bm1)
return -ENOMEM;
@ -1132,7 +1132,7 @@ int create_basic_memory_bitmaps(void)
if (error)
goto Free_first_object;
bm2 = kzalloc_obj(struct memory_bitmap, GFP_KERNEL);
bm2 = kzalloc_obj(struct memory_bitmap);
if (!bm2)
goto Free_first_bitmap;

View file

@ -155,7 +155,7 @@ static int swsusp_extents_insert(unsigned long swap_offset)
}
}
/* Add the new node and rebalance the tree. */
ext = kzalloc_obj(struct swsusp_extent, GFP_KERNEL);
ext = kzalloc_obj(struct swsusp_extent);
if (!ext)
return -ENOMEM;
@ -577,7 +577,7 @@ static struct crc_data *alloc_crc_data(int nr_threads)
{
struct crc_data *crc;
crc = kzalloc_obj(*crc, GFP_KERNEL);
crc = kzalloc_obj(*crc);
if (!crc)
return NULL;
@ -585,7 +585,7 @@ static struct crc_data *alloc_crc_data(int nr_threads)
if (!crc->unc)
goto err_free_crc;
crc->unc_len = kzalloc_objs(*crc->unc_len, nr_threads, GFP_KERNEL);
crc->unc_len = kzalloc_objs(*crc->unc_len, nr_threads);
if (!crc->unc_len)
goto err_free_unc;
@ -1016,7 +1016,7 @@ static int get_swap_reader(struct swap_map_handle *handle,
last = handle->maps = NULL;
offset = swsusp_header->image;
while (offset) {
tmp = kzalloc_obj(*handle->maps, GFP_KERNEL);
tmp = kzalloc_obj(*handle->maps);
if (!tmp) {
release_swap_reader(handle);
return -ENOMEM;

View file

@ -178,7 +178,7 @@ static struct wakelock *wakelock_lookup_add(const char *name, size_t len,
return ERR_PTR(-ENOSPC);
/* Not found, we have to add a new one. */
wl = kzalloc_obj(*wl, GFP_KERNEL);
wl = kzalloc_obj(*wl);
if (!wl)
return ERR_PTR(-ENOMEM);

View file

@ -1801,7 +1801,7 @@ bool nbcon_alloc(struct console *con)
*/
con->pbufs = &printk_shared_pbufs;
} else {
con->pbufs = kmalloc_obj(*con->pbufs, GFP_KERNEL);
con->pbufs = kmalloc_obj(*con->pbufs);
if (!con->pbufs) {
con_printk(KERN_ERR, con, "failed to allocate printing buffer\n");
return false;

View file

@ -933,7 +933,7 @@ static int devkmsg_open(struct inode *inode, struct file *file)
return err;
}
user = kvmalloc_obj(struct devkmsg_user, GFP_KERNEL);
user = kvmalloc_obj(struct devkmsg_user);
if (!user)
return -ENOMEM;

View file

@ -1130,7 +1130,7 @@ rcu_scale_init(void)
goto unwind;
schedule_timeout_uninterruptible(1);
}
reader_tasks = kzalloc_objs(reader_tasks[0], nrealreaders, GFP_KERNEL);
reader_tasks = kzalloc_objs(reader_tasks[0], nrealreaders);
if (reader_tasks == NULL) {
SCALEOUT_ERRSTRING("out of memory");
firsterr = -ENOMEM;
@ -1144,11 +1144,11 @@ rcu_scale_init(void)
}
while (atomic_read(&n_rcu_scale_reader_started) < nrealreaders)
schedule_timeout_uninterruptible(1);
writer_tasks = kzalloc_objs(writer_tasks[0], nrealwriters, GFP_KERNEL);
writer_tasks = kzalloc_objs(writer_tasks[0], nrealwriters);
writer_durations = kcalloc(nrealwriters, sizeof(*writer_durations), GFP_KERNEL);
writer_n_durations = kzalloc_objs(*writer_n_durations, nrealwriters,
GFP_KERNEL);
writer_done = kzalloc_objs(writer_done[0], nrealwriters, GFP_KERNEL);
writer_done = kzalloc_objs(writer_done[0], nrealwriters);
if (gp_async) {
if (gp_async_max <= 0) {
pr_warn("%s: gp_async_max = %d must be greater than zero.\n",

View file

@ -1626,7 +1626,7 @@ rcu_torture_writer(void *arg)
ulo_size = cur_ops->poll_active;
}
if (cur_ops->poll_active_full > 0) {
rgo = kzalloc_objs(*rgo, cur_ops->poll_active_full, GFP_KERNEL);
rgo = kzalloc_objs(*rgo, cur_ops->poll_active_full);
if (!WARN_ON(!rgo))
rgo_size = cur_ops->poll_active_full;
}
@ -2558,7 +2558,7 @@ static int rcu_torture_updown_init(void)
VERBOSE_TOROUT_STRING("rcu_torture_updown_init: Disabling up/down reader tests due to lack of primitives");
return 0;
}
updownreaders = kzalloc_objs(*updownreaders, n_up_down, GFP_KERNEL);
updownreaders = kzalloc_objs(*updownreaders, n_up_down);
if (!updownreaders) {
VERBOSE_TOROUT_STRING("rcu_torture_updown_init: Out of memory, disabling up/down reader tests");
return -ENOMEM;
@ -2891,7 +2891,7 @@ static void rcu_torture_mem_dump_obj(void)
mem_dump_obj(&z);
kmem_cache_free(kcp, rhp);
kmem_cache_destroy(kcp);
rhp = kmalloc_obj(*rhp, GFP_KERNEL);
rhp = kmalloc_obj(*rhp);
if (WARN_ON_ONCE(!rhp))
return;
pr_alert("mem_dump_obj() kmalloc test: rcu_torture_stats = %px, &rhp = %px, rhp = %px\n", stats_task, &rhp, rhp);
@ -3399,7 +3399,7 @@ static void rcu_torture_fwd_prog_cr(struct rcu_fwd *rfp)
n_launders++;
n_launders_sa++;
} else if (!cur_ops->cbflood_max || cur_ops->cbflood_max > n_max_cbs) {
rfcp = kmalloc_obj(*rfcp, GFP_KERNEL);
rfcp = kmalloc_obj(*rfcp);
if (WARN_ON_ONCE(!rfcp)) {
schedule_timeout_interruptible(1);
continue;
@ -3587,8 +3587,8 @@ static int __init rcu_torture_fwd_prog_init(void)
fwd_progress_holdoff = 1;
if (fwd_progress_div <= 0)
fwd_progress_div = 4;
rfp = kzalloc_objs(*rfp, fwd_progress, GFP_KERNEL);
fwd_prog_tasks = kzalloc_objs(*fwd_prog_tasks, fwd_progress, GFP_KERNEL);
rfp = kzalloc_objs(*rfp, fwd_progress);
fwd_prog_tasks = kzalloc_objs(*fwd_prog_tasks, fwd_progress);
if (!rfp || !fwd_prog_tasks) {
kfree(rfp);
kfree(fwd_prog_tasks);
@ -3754,9 +3754,9 @@ static int rcu_torture_barrier_init(void)
atomic_set(&barrier_cbs_count, 0);
atomic_set(&barrier_cbs_invoked, 0);
barrier_cbs_tasks =
kzalloc_objs(barrier_cbs_tasks[0], n_barrier_cbs, GFP_KERNEL);
kzalloc_objs(barrier_cbs_tasks[0], n_barrier_cbs);
barrier_cbs_wq =
kzalloc_objs(barrier_cbs_wq[0], n_barrier_cbs, GFP_KERNEL);
kzalloc_objs(barrier_cbs_wq[0], n_barrier_cbs);
if (barrier_cbs_tasks == NULL || !barrier_cbs_wq)
return -ENOMEM;
for (i = 0; i < n_barrier_cbs; i++) {
@ -4223,7 +4223,7 @@ static void rcu_test_debug_objects(void)
(!cur_ops->call || !cur_ops->cb_barrier)))
return;
struct rcu_head *rhp = kmalloc_obj(*rhp, GFP_KERNEL);
struct rcu_head *rhp = kmalloc_obj(*rhp);
init_rcu_head_on_stack(&rh1);
init_rcu_head_on_stack(&rh2);
@ -4562,7 +4562,7 @@ rcu_torture_init(void)
if (torture_init_error(firsterr))
goto unwind;
}
reader_tasks = kzalloc_objs(reader_tasks[0], nrealreaders, GFP_KERNEL);
reader_tasks = kzalloc_objs(reader_tasks[0], nrealreaders);
rcu_torture_reader_mbchk = kzalloc_objs(*rcu_torture_reader_mbchk,
nrealreaders, GFP_KERNEL);
if (!reader_tasks || !rcu_torture_reader_mbchk) {

View file

@ -1143,7 +1143,7 @@ static bool typesafe_init(void)
else if (si == 0)
si = nr_cpu_ids;
rtsarray_size = si;
rtsarray = kzalloc_objs(*rtsarray, si, GFP_KERNEL);
rtsarray = kzalloc_objs(*rtsarray, si);
if (!rtsarray)
return false;
for (idx = 0; idx < rtsarray_size; idx++) {
@ -1575,7 +1575,7 @@ ref_scale_init(void)
"%s: nreaders * loops will overflow, adjusted loops to %d",
__func__, INT_MAX / nreaders))
loops = INT_MAX / nreaders;
reader_tasks = kzalloc_objs(reader_tasks[0], nreaders, GFP_KERNEL);
reader_tasks = kzalloc_objs(reader_tasks[0], nreaders);
if (!reader_tasks) {
SCALEOUT_ERRSTRING("out of memory");
firsterr = -ENOMEM;

View file

@ -238,7 +238,7 @@ static bool init_srcu_struct_nodes(struct srcu_struct *ssp, gfp_t gfp_flags)
static int init_srcu_struct_fields(struct srcu_struct *ssp, bool is_static)
{
if (!is_static)
ssp->srcu_sup = kzalloc_obj(*ssp->srcu_sup, GFP_KERNEL);
ssp->srcu_sup = kzalloc_obj(*ssp->srcu_sup);
if (!ssp->srcu_sup)
return -ENOMEM;
if (!is_static)

View file

@ -614,7 +614,7 @@ static void early_boot_test_call_rcu(void)
call_rcu(&head, test_callback);
early_srcu_cookie = start_poll_synchronize_srcu(&early_srcu);
call_srcu(&early_srcu, &shead, test_callback);
rhp = kmalloc_obj(*rhp, GFP_KERNEL);
rhp = kmalloc_obj(*rhp);
if (!WARN_ON_ONCE(!rhp))
kfree_rcu(rhp, rh);
}

View file

@ -59,7 +59,7 @@ static const struct vm_operations_struct relay_file_mmap_ops = {
*/
static struct page **relay_alloc_page_array(unsigned int n_pages)
{
return kvzalloc_objs(struct page *, n_pages, GFP_KERNEL);
return kvzalloc_objs(struct page *, n_pages);
}
/*
@ -150,10 +150,10 @@ static struct rchan_buf *relay_create_buf(struct rchan *chan)
if (chan->n_subbufs > KMALLOC_MAX_SIZE / sizeof(size_t))
return NULL;
buf = kzalloc_obj(struct rchan_buf, GFP_KERNEL);
buf = kzalloc_obj(struct rchan_buf);
if (!buf)
return NULL;
buf->padding = kmalloc_objs(size_t, chan->n_subbufs, GFP_KERNEL);
buf->padding = kmalloc_objs(size_t, chan->n_subbufs);
if (!buf->padding)
goto free_buf;
@ -489,7 +489,7 @@ struct rchan *relay_open(const char *base_filename,
if (!cb || !cb->create_buf_file || !cb->remove_buf_file)
return NULL;
chan = kzalloc_obj(struct rchan, GFP_KERNEL);
chan = kzalloc_obj(struct rchan);
if (!chan)
return NULL;

View file

@ -502,7 +502,7 @@ int walk_system_ram_res_rev(u64 start, u64 end, void *arg,
int ret = -1;
/* create a list */
rams = kvzalloc_objs(struct resource, rams_size, GFP_KERNEL);
rams = kvzalloc_objs(struct resource, rams_size);
if (!rams)
return ret;

View file

@ -204,7 +204,7 @@ static void resource_test_insert_resource(struct kunit *test, struct resource *p
{
struct resource *res;
res = kzalloc_obj(*res, GFP_KERNEL);
res = kzalloc_obj(*res);
KUNIT_ASSERT_NOT_NULL(test, res);
res->name = name;

View file

@ -661,7 +661,7 @@ static int __init scf_torture_init(void)
// Worker tasks invoking smp_call_function().
if (nthreads < 0)
nthreads = num_online_cpus();
scf_stats_p = kzalloc_objs(scf_stats_p[0], nthreads, GFP_KERNEL);
scf_stats_p = kzalloc_objs(scf_stats_p[0], nthreads);
if (!scf_stats_p) {
SCFTORTOUT_ERRSTRING("out of memory");
firsterr = -ENOMEM;

View file

@ -86,7 +86,7 @@ static inline struct autogroup *autogroup_task_get(struct task_struct *p)
static inline struct autogroup *autogroup_create(void)
{
struct autogroup *ag = kzalloc_obj(*ag, GFP_KERNEL);
struct autogroup *ag = kzalloc_obj(*ag);
struct task_group *tg;
if (!ag)

View file

@ -12,7 +12,7 @@ struct sched_core_cookie {
static unsigned long sched_core_alloc_cookie(void)
{
struct sched_core_cookie *ck = kmalloc_obj(*ck, GFP_KERNEL);
struct sched_core_cookie *ck = kmalloc_obj(*ck);
if (!ck)
return 0;

View file

@ -61,7 +61,7 @@ cpuacct_css_alloc(struct cgroup_subsys_state *parent_css)
if (!parent_css)
return &root_cpuacct.css;
ca = kzalloc_obj(*ca, GFP_KERNEL);
ca = kzalloc_obj(*ca);
if (!ca)
goto out;

View file

@ -252,7 +252,7 @@ int cpudl_init(struct cpudl *cp)
raw_spin_lock_init(&cp->lock);
cp->size = 0;
cp->elements = kzalloc_objs(struct cpudl_item, nr_cpu_ids, GFP_KERNEL);
cp->elements = kzalloc_objs(struct cpudl_item, nr_cpu_ids);
if (!cp->elements)
return -ENOMEM;

View file

@ -638,7 +638,7 @@ static struct sugov_policy *sugov_policy_alloc(struct cpufreq_policy *policy)
{
struct sugov_policy *sg_policy;
sg_policy = kzalloc_obj(*sg_policy, GFP_KERNEL);
sg_policy = kzalloc_obj(*sg_policy);
if (!sg_policy)
return NULL;
@ -722,7 +722,7 @@ static struct sugov_tunables *sugov_tunables_alloc(struct sugov_policy *sg_polic
{
struct sugov_tunables *tunables;
tunables = kzalloc_obj(*tunables, GFP_KERNEL);
tunables = kzalloc_obj(*tunables);
if (tunables) {
gov_attr_set_init(&tunables->attr_set, &sg_policy->tunables_hook);
if (!have_governor_per_policy())

View file

@ -288,7 +288,7 @@ int cpupri_init(struct cpupri *cp)
goto cleanup;
}
cp->cpu_to_pri = kzalloc_objs(int, nr_cpu_ids, GFP_KERNEL);
cp->cpu_to_pri = kzalloc_objs(int, nr_cpu_ids);
if (!cp->cpu_to_pri)
goto cleanup;

View file

@ -4223,11 +4223,11 @@ static struct scx_exit_info *alloc_exit_info(size_t exit_dump_len)
{
struct scx_exit_info *ei;
ei = kzalloc_obj(*ei, GFP_KERNEL);
ei = kzalloc_obj(*ei);
if (!ei)
return NULL;
ei->bt = kzalloc_objs(ei->bt[0], SCX_EXIT_BT_LEN, GFP_KERNEL);
ei->bt = kzalloc_objs(ei->bt[0], SCX_EXIT_BT_LEN);
ei->msg = kzalloc(SCX_EXIT_MSG_LEN, GFP_KERNEL);
ei->dump = kvzalloc(exit_dump_len, GFP_KERNEL);
@ -4824,7 +4824,7 @@ static struct scx_sched *scx_alloc_and_add_sched(struct sched_ext_ops *ops)
struct scx_sched *sch;
int node, ret;
sch = kzalloc_obj(*sch, GFP_KERNEL);
sch = kzalloc_obj(*sch);
if (!sch)
return ERR_PTR(-ENOMEM);

View file

@ -3427,7 +3427,7 @@ retry_pids:
if (!vma->numab_state) {
struct vma_numab_state *ptr;
ptr = kzalloc_obj(*ptr, GFP_KERNEL);
ptr = kzalloc_obj(*ptr);
if (!ptr)
continue;
@ -13622,10 +13622,10 @@ int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent)
struct cfs_rq *cfs_rq;
int i;
tg->cfs_rq = kzalloc_objs(cfs_rq, nr_cpu_ids, GFP_KERNEL);
tg->cfs_rq = kzalloc_objs(cfs_rq, nr_cpu_ids);
if (!tg->cfs_rq)
goto err;
tg->se = kzalloc_objs(se, nr_cpu_ids, GFP_KERNEL);
tg->se = kzalloc_objs(se, nr_cpu_ids);
if (!tg->se)
goto err;

View file

@ -1114,7 +1114,7 @@ int psi_cgroup_alloc(struct cgroup *cgroup)
if (!static_branch_likely(&psi_cgroups_enabled))
return 0;
cgroup->psi = kzalloc_obj(struct psi_group, GFP_KERNEL);
cgroup->psi = kzalloc_obj(struct psi_group);
if (!cgroup->psi)
return -ENOMEM;
@ -1340,7 +1340,7 @@ struct psi_trigger *psi_trigger_create(struct psi_group *group, char *buf,
if (threshold_us == 0 || threshold_us > window_us)
return ERR_PTR(-EINVAL);
t = kmalloc_obj(*t, GFP_KERNEL);
t = kmalloc_obj(*t);
if (!t)
return ERR_PTR(-ENOMEM);

View file

@ -259,10 +259,10 @@ int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent)
if (!rt_group_sched_enabled())
return 1;
tg->rt_rq = kzalloc_objs(rt_rq, nr_cpu_ids, GFP_KERNEL);
tg->rt_rq = kzalloc_objs(rt_rq, nr_cpu_ids);
if (!tg->rt_rq)
goto err;
tg->rt_se = kzalloc_objs(rt_se, nr_cpu_ids, GFP_KERNEL);
tg->rt_se = kzalloc_objs(rt_se, nr_cpu_ids);
if (!tg->rt_se)
goto err;

View file

@ -350,7 +350,7 @@ static struct perf_domain *pd_init(int cpu)
return NULL;
}
pd = kzalloc_obj(*pd, GFP_KERNEL);
pd = kzalloc_obj(*pd);
if (!pd)
return NULL;
pd->em_pd = obj;
@ -589,7 +589,7 @@ static struct root_domain *alloc_rootdomain(void)
{
struct root_domain *rd;
rd = kzalloc_obj(*rd, GFP_KERNEL);
rd = kzalloc_obj(*rd);
if (!rd)
return NULL;
@ -1998,7 +1998,7 @@ static int sched_record_numa_dist(int offline_node, int (*n_dist)(int, int),
*/
nr_levels = bitmap_weight(distance_map, NR_DISTANCE_VALUES);
distances = kzalloc_objs(int, nr_levels, GFP_KERNEL);
distances = kzalloc_objs(int, nr_levels);
if (!distances)
return -ENOMEM;
@ -2734,7 +2734,7 @@ cpumask_var_t *alloc_sched_domains(unsigned int ndoms)
int i;
cpumask_var_t *doms;
doms = kmalloc_objs(*doms, ndoms, GFP_KERNEL);
doms = kmalloc_objs(*doms, ndoms);
if (!doms)
return NULL;
for (i = 0; i < ndoms; i++) {

Some files were not shown because too many files have changed in this diff Show more