summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-02-21 16:37:42 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2026-02-21 17:09:51 -0800
commitbf4afc53b77aeaa48b5409da5c8da6bb4eff7f43 (patch)
tree01fdd9d27f1b272bef0127966e08eac44d134d0a /security
parente19e1b480ac73c3e62ffebbca1174f0f511f43e7 (diff)
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>
Diffstat (limited to 'security')
-rw-r--r--security/apparmor/apparmorfs.c2
-rw-r--r--security/apparmor/lsm.c2
-rw-r--r--security/apparmor/match.c2
-rw-r--r--security/apparmor/policy_compat.c6
-rw-r--r--security/apparmor/policy_ns.c2
-rw-r--r--security/apparmor/policy_unpack.c14
-rw-r--r--security/device_cgroup.c2
-rw-r--r--security/integrity/digsig.c2
-rw-r--r--security/integrity/evm/evm_secfs.c2
-rw-r--r--security/integrity/ima/ima_mok.c2
-rw-r--r--security/integrity/ima/ima_policy.c2
-rw-r--r--security/integrity/ima/ima_queue.c2
-rw-r--r--security/integrity/ima/ima_queue_keys.c2
-rw-r--r--security/integrity/ima/ima_template.c4
-rw-r--r--security/ipe/digest.c2
-rw-r--r--security/ipe/hooks.c2
-rw-r--r--security/ipe/policy.c2
-rw-r--r--security/ipe/policy_parser.c6
-rw-r--r--security/keys/key.c2
-rw-r--r--security/keys/keyctl.c4
-rw-r--r--security/keys/keyring.c2
-rw-r--r--security/keys/request_key_auth.c2
-rw-r--r--security/keys/trusted-keys/trusted_core.c2
-rw-r--r--security/keys/trusted-keys/trusted_pkwm.c4
-rw-r--r--security/keys/trusted-keys/trusted_tpm1.c6
-rw-r--r--security/safesetid/securityfs.c6
-rw-r--r--security/selinux/avc.c2
-rw-r--r--security/selinux/hooks.c4
-rw-r--r--security/selinux/selinuxfs.c4
-rw-r--r--security/selinux/ss/conditional.c10
-rw-r--r--security/selinux/ss/hashtab.c2
-rw-r--r--security/selinux/ss/policydb.c44
-rw-r--r--security/selinux/ss/services.c6
-rw-r--r--security/smack/smack_lsm.c8
-rw-r--r--security/smack/smackfs.c6
-rw-r--r--security/yama/yama_lsm.c2
36 files changed, 87 insertions, 87 deletions
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index 283e622a7ccc..2f84bd23edb6 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -570,7 +570,7 @@ static ssize_t ns_revision_read(struct file *file, char __user *buf,
static int ns_revision_open(struct inode *inode, struct file *file)
{
- struct aa_revision *rev = kzalloc_obj(*rev, GFP_KERNEL);
+ struct aa_revision *rev = kzalloc_obj(*rev);
if (!rev)
return -ENOMEM;
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
index 92ea1bc7b9e0..c1d42fc72fdb 100644
--- a/security/apparmor/lsm.c
+++ b/security/apparmor/lsm.c
@@ -2468,7 +2468,7 @@ static int __init aa_setup_dfa_engine(void)
goto fail;
}
nullpdb->dfa = aa_get_dfa(nulldfa);
- nullpdb->perms = kzalloc_objs(struct aa_perms, 2, GFP_KERNEL);
+ nullpdb->perms = kzalloc_objs(struct aa_perms, 2);
if (!nullpdb->perms)
goto fail;
nullpdb->size = 2;
diff --git a/security/apparmor/match.c b/security/apparmor/match.c
index 5ee25d4016e0..8fa0a1494acd 100644
--- a/security/apparmor/match.c
+++ b/security/apparmor/match.c
@@ -301,7 +301,7 @@ struct aa_dfa *aa_dfa_unpack(void *blob, size_t size, int flags)
int error = -ENOMEM;
char *data = blob;
struct table_header *table = NULL;
- struct aa_dfa *dfa = kzalloc_obj(struct aa_dfa, GFP_KERNEL);
+ struct aa_dfa *dfa = kzalloc_obj(struct aa_dfa);
if (!dfa)
goto fail;
diff --git a/security/apparmor/policy_compat.c b/security/apparmor/policy_compat.c
index 928dbb10cec1..5fc16d56fbf4 100644
--- a/security/apparmor/policy_compat.c
+++ b/security/apparmor/policy_compat.c
@@ -158,7 +158,7 @@ static struct aa_perms *compute_fperms(struct aa_dfa *dfa,
state_count = dfa->tables[YYTD_ID_BASE]->td_lolen;
/* DFAs are restricted from having a state_count of less than 2 */
- table = kvzalloc_objs(struct aa_perms, state_count * 2, GFP_KERNEL);
+ table = kvzalloc_objs(struct aa_perms, state_count * 2);
if (!table)
return NULL;
*size = state_count * 2;
@@ -182,7 +182,7 @@ static struct aa_perms *compute_xmatch_perms(struct aa_dfa *xmatch,
state_count = xmatch->tables[YYTD_ID_BASE]->td_lolen;
/* DFAs are restricted from having a state_count of less than 2 */
- perms = kvzalloc_objs(struct aa_perms, state_count, GFP_KERNEL);
+ perms = kvzalloc_objs(struct aa_perms, state_count);
if (!perms)
return NULL;
*size = state_count;
@@ -257,7 +257,7 @@ static struct aa_perms *compute_perms(struct aa_dfa *dfa, u32 version,
state_count = dfa->tables[YYTD_ID_BASE]->td_lolen;
/* DFAs are restricted from having a state_count of less than 2 */
- table = kvzalloc_objs(struct aa_perms, state_count, GFP_KERNEL);
+ table = kvzalloc_objs(struct aa_perms, state_count);
if (!table)
return NULL;
*size = state_count;
diff --git a/security/apparmor/policy_ns.c b/security/apparmor/policy_ns.c
index 099b71957ccb..01b653a3609b 100644
--- a/security/apparmor/policy_ns.c
+++ b/security/apparmor/policy_ns.c
@@ -106,7 +106,7 @@ static struct aa_ns *alloc_ns(const char *prefix, const char *name)
{
struct aa_ns *ns;
- ns = kzalloc_obj(*ns, GFP_KERNEL);
+ ns = kzalloc_obj(*ns);
AA_DEBUG(DEBUG_POLICY, "%s(%p)\n", __func__, ns);
if (!ns)
return NULL;
diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c
index 9001c6ebc235..2b7ccc4e3853 100644
--- a/security/apparmor/policy_unpack.c
+++ b/security/apparmor/policy_unpack.c
@@ -145,7 +145,7 @@ struct aa_loaddata *aa_loaddata_alloc(size_t size)
{
struct aa_loaddata *d;
- d = kzalloc_obj(*d, GFP_KERNEL);
+ d = kzalloc_obj(*d);
if (d == NULL)
return ERR_PTR(-ENOMEM);
d->data = kvzalloc(size, GFP_KERNEL);
@@ -528,7 +528,7 @@ static int unpack_strs_table(struct aa_ext *e, const char *name, bool multi,
* for size check here
*/
goto fail;
- table = kzalloc_objs(struct aa_str_table_ent, size, GFP_KERNEL);
+ table = kzalloc_objs(struct aa_str_table_ent, size);
if (!table) {
error = -ENOMEM;
goto fail;
@@ -809,7 +809,7 @@ static int unpack_tag_headers(struct aa_ext *e, struct aa_tags_struct *tags)
if (!aa_unpack_array(e, "hdrs", &size))
goto fail_reset;
- hdrs = kzalloc_objs(struct aa_tags_header, size, GFP_KERNEL);
+ hdrs = kzalloc_objs(struct aa_tags_header, size);
if (!hdrs) {
error = -ENOMEM;
goto fail_reset;
@@ -922,7 +922,7 @@ static ssize_t unpack_perms_table(struct aa_ext *e, struct aa_perms **perms)
goto fail_reset;
if (!aa_unpack_array(e, NULL, &size))
goto fail_reset;
- *perms = kzalloc_objs(struct aa_perms, size, GFP_KERNEL);
+ *perms = kzalloc_objs(struct aa_perms, size);
if (!*perms) {
e->pos = pos;
return -ENOMEM;
@@ -1320,7 +1320,7 @@ static struct aa_profile *unpack_profile(struct aa_ext *e, char **ns_name)
error = -EPROTO;
if (aa_unpack_nameX(e, AA_STRUCT, "data")) {
info = "out of memory";
- profile->data = kzalloc_obj(*profile->data, GFP_KERNEL);
+ profile->data = kzalloc_obj(*profile->data);
if (!profile->data) {
error = -ENOMEM;
goto fail;
@@ -1338,7 +1338,7 @@ static struct aa_profile *unpack_profile(struct aa_ext *e, char **ns_name)
}
while (aa_unpack_strdup(e, &key, NULL)) {
- data = kzalloc_obj(*data, GFP_KERNEL);
+ data = kzalloc_obj(*data);
if (!data) {
kfree_sensitive(key);
error = -ENOMEM;
@@ -1583,7 +1583,7 @@ void aa_load_ent_free(struct aa_load_ent *ent)
struct aa_load_ent *aa_load_ent_alloc(void)
{
- struct aa_load_ent *ent = kzalloc_obj(*ent, GFP_KERNEL);
+ struct aa_load_ent *ent = kzalloc_obj(*ent);
if (ent)
INIT_LIST_HEAD(&ent->list);
return ent;
diff --git a/security/device_cgroup.c b/security/device_cgroup.c
index 27610fa31b61..cd166dee66b7 100644
--- a/security/device_cgroup.c
+++ b/security/device_cgroup.c
@@ -223,7 +223,7 @@ devcgroup_css_alloc(struct cgroup_subsys_state *parent_css)
{
struct dev_cgroup *dev_cgroup;
- dev_cgroup = kzalloc_obj(*dev_cgroup, GFP_KERNEL);
+ dev_cgroup = kzalloc_obj(*dev_cgroup);
if (!dev_cgroup)
return ERR_PTR(-ENOMEM);
INIT_LIST_HEAD(&dev_cgroup->exceptions);
diff --git a/security/integrity/digsig.c b/security/integrity/digsig.c
index aec350abad86..75c684cce370 100644
--- a/security/integrity/digsig.c
+++ b/security/integrity/digsig.c
@@ -141,7 +141,7 @@ int __init integrity_init_keyring(const unsigned int id)
if (!IS_ENABLED(CONFIG_INTEGRITY_TRUSTED_KEYRING))
return 0;
- restriction = kzalloc_obj(struct key_restriction, GFP_KERNEL);
+ restriction = kzalloc_obj(struct key_restriction);
if (!restriction)
return -ENOMEM;
diff --git a/security/integrity/evm/evm_secfs.c b/security/integrity/evm/evm_secfs.c
index a8893b90a0fa..acd840461902 100644
--- a/security/integrity/evm/evm_secfs.c
+++ b/security/integrity/evm/evm_secfs.c
@@ -199,7 +199,7 @@ static ssize_t evm_write_xattrs(struct file *file, const char __user *buf,
if (!ab && IS_ENABLED(CONFIG_AUDIT))
return -ENOMEM;
- xattr = kmalloc_obj(struct xattr_list, GFP_KERNEL);
+ xattr = kmalloc_obj(struct xattr_list);
if (!xattr) {
err = -ENOMEM;
goto out;
diff --git a/security/integrity/ima/ima_mok.c b/security/integrity/ima/ima_mok.c
index c647f4fd114d..14d93d573a6a 100644
--- a/security/integrity/ima/ima_mok.c
+++ b/security/integrity/ima/ima_mok.c
@@ -27,7 +27,7 @@ static __init int ima_mok_init(void)
pr_notice("Allocating IMA blacklist keyring.\n");
- restriction = kzalloc_obj(struct key_restriction, GFP_KERNEL);
+ restriction = kzalloc_obj(struct key_restriction);
if (!restriction)
panic("Can't allocate IMA blacklist restriction.");
diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
index c99f52458cd5..420642f96cab 100644
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -1976,7 +1976,7 @@ ssize_t ima_parse_add_rule(char *rule)
if (*p == '#' || *p == '\0')
return len;
- entry = kzalloc_obj(*entry, GFP_KERNEL);
+ entry = kzalloc_obj(*entry);
if (!entry) {
integrity_audit_msg(AUDIT_INTEGRITY_STATUS, NULL,
NULL, op, "-ENOMEM", -ENOMEM, audit_info);
diff --git a/security/integrity/ima/ima_queue.c b/security/integrity/ima/ima_queue.c
index 859c83ab5a2b..319522450854 100644
--- a/security/integrity/ima/ima_queue.c
+++ b/security/integrity/ima/ima_queue.c
@@ -103,7 +103,7 @@ static int ima_add_digest_entry(struct ima_template_entry *entry,
struct ima_queue_entry *qe;
unsigned int key;
- qe = kmalloc_obj(*qe, GFP_KERNEL);
+ qe = kmalloc_obj(*qe);
if (qe == NULL) {
pr_err("OUT OF MEMORY ERROR creating queue entry\n");
return -ENOMEM;
diff --git a/security/integrity/ima/ima_queue_keys.c b/security/integrity/ima/ima_queue_keys.c
index da29e5b8f6df..b5ed33cbb272 100644
--- a/security/integrity/ima/ima_queue_keys.c
+++ b/security/integrity/ima/ima_queue_keys.c
@@ -72,7 +72,7 @@ static struct ima_key_entry *ima_alloc_key_entry(struct key *keyring,
const char *audit_cause = "ENOMEM";
struct ima_key_entry *entry;
- entry = kzalloc_obj(*entry, GFP_KERNEL);
+ entry = kzalloc_obj(*entry);
if (entry) {
entry->payload = kmemdup(payload, payload_len, GFP_KERNEL);
entry->keyring_name = kstrdup(keyring->description,
diff --git a/security/integrity/ima/ima_template.c b/security/integrity/ima/ima_template.c
index 9712eb6b4b88..7034573fb41e 100644
--- a/security/integrity/ima/ima_template.c
+++ b/security/integrity/ima/ima_template.c
@@ -245,7 +245,7 @@ int template_desc_init_fields(const char *template_fmt,
}
if (fields && num_fields) {
- *fields = kmalloc_objs(**fields, i, GFP_KERNEL);
+ *fields = kmalloc_objs(**fields, i);
if (*fields == NULL)
return -ENOMEM;
@@ -334,7 +334,7 @@ static struct ima_template_desc *restore_template_fmt(char *template_name)
goto out;
}
- template_desc = kzalloc_obj(*template_desc, GFP_KERNEL);
+ template_desc = kzalloc_obj(*template_desc);
if (!template_desc)
goto out;
diff --git a/security/ipe/digest.c b/security/ipe/digest.c
index 747768ba0e52..6e597a6b7633 100644
--- a/security/ipe/digest.c
+++ b/security/ipe/digest.c
@@ -29,7 +29,7 @@ struct digest_info *ipe_digest_parse(const char *valstr)
char *alg = NULL;
int rc = 0;
- info = kzalloc_obj(*info, GFP_KERNEL);
+ info = kzalloc_obj(*info);
if (!info)
return ERR_PTR(-ENOMEM);
diff --git a/security/ipe/hooks.c b/security/ipe/hooks.c
index b8d677f87845..0ae54a880405 100644
--- a/security/ipe/hooks.c
+++ b/security/ipe/hooks.c
@@ -287,7 +287,7 @@ int ipe_bdev_setintegrity(struct block_device *bdev, enum lsm_integrity_type typ
}
digest = value;
- info = kzalloc_obj(*info, GFP_KERNEL);
+ info = kzalloc_obj(*info);
if (!info)
return -ENOMEM;
diff --git a/security/ipe/policy.c b/security/ipe/policy.c
index c2ff142aed37..827867be4fac 100644
--- a/security/ipe/policy.c
+++ b/security/ipe/policy.c
@@ -162,7 +162,7 @@ struct ipe_policy *ipe_new_policy(const char *text, size_t textlen,
struct ipe_policy *new = NULL;
int rc = 0;
- new = kzalloc_obj(*new, GFP_KERNEL);
+ new = kzalloc_obj(*new);
if (!new)
return ERR_PTR(-ENOMEM);
diff --git a/security/ipe/policy_parser.c b/security/ipe/policy_parser.c
index 180de3e5f200..6fa5bebf8471 100644
--- a/security/ipe/policy_parser.c
+++ b/security/ipe/policy_parser.c
@@ -30,7 +30,7 @@ static struct ipe_parsed_policy *new_parsed_policy(void)
struct ipe_op_table *t = NULL;
size_t i = 0;
- p = kzalloc_obj(*p, GFP_KERNEL);
+ p = kzalloc_obj(*p);
if (!p)
return ERR_PTR(-ENOMEM);
@@ -305,7 +305,7 @@ static int parse_property(char *t, struct ipe_rule *r)
int token;
char *dup = NULL;
- p = kzalloc_obj(*p, GFP_KERNEL);
+ p = kzalloc_obj(*p);
if (!p)
return -ENOMEM;
@@ -373,7 +373,7 @@ static int parse_rule(char *line, struct ipe_parsed_policy *p)
if (IS_ERR_OR_NULL(line))
return -EBADMSG;
- r = kzalloc_obj(*r, GFP_KERNEL);
+ r = kzalloc_obj(*r);
if (!r)
return -ENOMEM;
diff --git a/security/keys/key.c b/security/keys/key.c
index 8ca0777f22d3..091ee084bc30 100644
--- a/security/keys/key.c
+++ b/security/keys/key.c
@@ -77,7 +77,7 @@ try_again:
spin_unlock(&key_user_lock);
user = NULL;
- candidate = kmalloc_obj(struct key_user, GFP_KERNEL);
+ candidate = kmalloc_obj(struct key_user);
if (unlikely(!candidate))
goto out;
diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index 7d8a0de7c7c4..ef855d69c97a 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -1796,13 +1796,13 @@ long keyctl_watch_key(key_serial_t id, int watch_queue_fd, int watch_id)
if (watch_id >= 0) {
ret = -ENOMEM;
if (!key->watchers) {
- wlist = kzalloc_obj(*wlist, GFP_KERNEL);
+ wlist = kzalloc_obj(*wlist);
if (!wlist)
goto err_wqueue;
init_watch_list(wlist, NULL);
}
- watch = kzalloc_obj(*watch, GFP_KERNEL);
+ watch = kzalloc_obj(*watch);
if (!watch)
goto err_wlist;
diff --git a/security/keys/keyring.c b/security/keys/keyring.c
index 9a1685035be5..b39038f7dd31 100644
--- a/security/keys/keyring.c
+++ b/security/keys/keyring.c
@@ -977,7 +977,7 @@ static struct key_restriction *keyring_restriction_alloc(
key_restrict_link_func_t check)
{
struct key_restriction *keyres =
- kzalloc_obj(struct key_restriction, GFP_KERNEL);
+ kzalloc_obj(struct key_restriction);
if (!keyres)
return ERR_PTR(-ENOMEM);
diff --git a/security/keys/request_key_auth.c b/security/keys/request_key_auth.c
index f0de3e9d9743..a7d7538c1f70 100644
--- a/security/keys/request_key_auth.c
+++ b/security/keys/request_key_auth.c
@@ -171,7 +171,7 @@ struct key *request_key_auth_new(struct key *target, const char *op,
kenter("%d,", target->serial);
/* allocate a auth record */
- rka = kzalloc_obj(*rka, GFP_KERNEL);
+ rka = kzalloc_obj(*rka);
if (!rka)
goto error;
rka->callout_info = kmemdup(callout_info, callout_len, GFP_KERNEL);
diff --git a/security/keys/trusted-keys/trusted_core.c b/security/keys/trusted-keys/trusted_core.c
index fb9ff3d18292..0b142d941cd2 100644
--- a/security/keys/trusted-keys/trusted_core.c
+++ b/security/keys/trusted-keys/trusted_core.c
@@ -134,7 +134,7 @@ static struct trusted_key_payload *trusted_payload_alloc(struct key *key)
ret = key_payload_reserve(key, sizeof(*p));
if (ret < 0)
goto err;
- p = kzalloc_obj(*p, GFP_KERNEL);
+ p = kzalloc_obj(*p);
if (!p)
goto err;
diff --git a/security/keys/trusted-keys/trusted_pkwm.c b/security/keys/trusted-keys/trusted_pkwm.c
index aab8fbc49280..bf42c6679245 100644
--- a/security/keys/trusted-keys/trusted_pkwm.c
+++ b/security/keys/trusted-keys/trusted_pkwm.c
@@ -62,10 +62,10 @@ static struct trusted_key_options *trusted_options_alloc(void)
struct trusted_key_options *options;
struct trusted_pkwm_options *pkwm;
- options = kzalloc_obj(*options, GFP_KERNEL);
+ options = kzalloc_obj(*options);
if (options) {
- pkwm = kzalloc_obj(*pkwm, GFP_KERNEL);
+ pkwm = kzalloc_obj(*pkwm);
if (!pkwm) {
kfree_sensitive(options);
diff --git a/security/keys/trusted-keys/trusted_tpm1.c b/security/keys/trusted-keys/trusted_tpm1.c
index ce9b26dd846e..6ea728f1eae6 100644
--- a/security/keys/trusted-keys/trusted_tpm1.c
+++ b/security/keys/trusted-keys/trusted_tpm1.c
@@ -440,7 +440,7 @@ static int tpm_seal(struct tpm_buf *tb, uint16_t keytype,
int i;
/* alloc some work space for all the hashes */
- td = kmalloc_obj(*td, GFP_KERNEL);
+ td = kmalloc_obj(*td);
if (!td)
return -ENOMEM;
@@ -838,7 +838,7 @@ static struct trusted_key_options *trusted_options_alloc(void)
if (tpm2 < 0)
return NULL;
- options = kzalloc_obj(*options, GFP_KERNEL);
+ options = kzalloc_obj(*options);
if (options) {
/* set any non-zero defaults */
options->keytype = SRK_keytype;
@@ -946,7 +946,7 @@ static int __init init_digests(void)
{
int i;
- digests = kzalloc_objs(*digests, chip->nr_allocated_banks, GFP_KERNEL);
+ digests = kzalloc_objs(*digests, chip->nr_allocated_banks);
if (!digests)
return -ENOMEM;
diff --git a/security/safesetid/securityfs.c b/security/safesetid/securityfs.c
index 8cc2bcb07324..a71e548065a9 100644
--- a/security/safesetid/securityfs.c
+++ b/security/safesetid/securityfs.c
@@ -118,7 +118,7 @@ static int verify_ruleset(struct setid_ruleset *pol)
res = -EINVAL;
/* fix it up */
- nrule = kmalloc_obj(struct setid_rule, GFP_KERNEL);
+ nrule = kmalloc_obj(struct setid_rule);
if (!nrule)
return -ENOMEM;
if (pol->type == UID){
@@ -146,7 +146,7 @@ static ssize_t handle_policy_update(struct file *file,
if (len >= KMALLOC_MAX_SIZE)
return -EINVAL;
- pol = kmalloc_obj(struct setid_ruleset, GFP_KERNEL);
+ pol = kmalloc_obj(struct setid_ruleset);
if (!pol)
return -ENOMEM;
pol->policy_str = NULL;
@@ -175,7 +175,7 @@ static ssize_t handle_policy_update(struct file *file,
}
*end = '\0';
- rule = kmalloc_obj(struct setid_rule, GFP_KERNEL);
+ rule = kmalloc_obj(struct setid_rule);
if (!rule) {
err = -ENOMEM;
goto out_free_buf;
diff --git a/security/selinux/avc.c b/security/selinux/avc.c
index 584b1d6bdff1..813e82bcfc27 100644
--- a/security/selinux/avc.c
+++ b/security/selinux/avc.c
@@ -794,7 +794,7 @@ int __init avc_add_callback(int (*callback)(u32 event), u32 events)
struct avc_callback_node *c;
int rc = 0;
- c = kmalloc_obj(*c, GFP_KERNEL);
+ c = kmalloc_obj(*c);
if (!c) {
rc = -ENOMEM;
goto out;
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 58ce110272ef..d8224ea113d1 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -1030,7 +1030,7 @@ static int selinux_add_opt(int token, const char *s, void **mnt_opts)
}
if (!opts) {
- opts = kzalloc_obj(*opts, GFP_KERNEL);
+ opts = kzalloc_obj(*opts);
if (!opts)
return -ENOMEM;
*mnt_opts = opts;
@@ -2822,7 +2822,7 @@ static int selinux_fs_context_submount(struct fs_context *fc,
if (!(sbsec->flags & (FSCONTEXT_MNT|CONTEXT_MNT|DEFCONTEXT_MNT)))
return 0;
- opts = kzalloc_obj(*opts, GFP_KERNEL);
+ opts = kzalloc_obj(*opts);
if (!opts)
return -ENOMEM;
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index 010499520d38..3245cc531555 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -85,7 +85,7 @@ static int selinux_fs_info_create(struct super_block *sb)
{
struct selinux_fs_info *fsi;
- fsi = kzalloc_obj(*fsi, GFP_KERNEL);
+ fsi = kzalloc_obj(*fsi);
if (!fsi)
return -ENOMEM;
@@ -380,7 +380,7 @@ static int sel_open_policy(struct inode *inode, struct file *filp)
goto err;
rc = -ENOMEM;
- plm = kzalloc_obj(*plm, GFP_KERNEL);
+ plm = kzalloc_obj(*plm);
if (!plm)
goto err;
diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c
index b238fa9756cf..807e464340c7 100644
--- a/security/selinux/ss/conditional.c
+++ b/security/selinux/ss/conditional.c
@@ -214,7 +214,7 @@ int cond_read_bool(struct policydb *p, struct symtab *s, struct policy_file *fp)
u32 len;
int rc;
- booldatum = kzalloc_obj(*booldatum, GFP_KERNEL);
+ booldatum = kzalloc_obj(*booldatum);
if (!booldatum)
return -ENOMEM;
@@ -334,7 +334,7 @@ static int cond_read_av_list(struct policydb *p, struct policy_file *fp,
if (len == 0)
return 0;
- list->nodes = kzalloc_objs(*list->nodes, len, GFP_KERNEL);
+ list->nodes = kzalloc_objs(*list->nodes, len);
if (!list->nodes)
return -ENOMEM;
@@ -383,7 +383,7 @@ static int cond_read_node(struct policydb *p, struct cond_node *node, struct pol
/* expr */
len = le32_to_cpu(buf[1]);
- node->expr.nodes = kzalloc_objs(*node->expr.nodes, len, GFP_KERNEL);
+ node->expr.nodes = kzalloc_objs(*node->expr.nodes, len);
if (!node->expr.nodes)
return -ENOMEM;
@@ -421,7 +421,7 @@ int cond_read_list(struct policydb *p, struct policy_file *fp)
len = le32_to_cpu(buf[0]);
- p->cond_list = kzalloc_objs(*p->cond_list, len, GFP_KERNEL);
+ p->cond_list = kzalloc_objs(*p->cond_list, len);
if (!p->cond_list)
return -ENOMEM;
@@ -605,7 +605,7 @@ static int cond_dup_av_list(struct cond_av_list *new,
memset(new, 0, sizeof(*new));
- new->nodes = kzalloc_objs(*new->nodes, orig->len, GFP_KERNEL);
+ new->nodes = kzalloc_objs(*new->nodes, orig->len);
if (!new->nodes)
return -ENOMEM;
diff --git a/security/selinux/ss/hashtab.c b/security/selinux/ss/hashtab.c
index 1eb542725c94..9ffc8a371e23 100644
--- a/security/selinux/ss/hashtab.c
+++ b/security/selinux/ss/hashtab.c
@@ -149,7 +149,7 @@ int hashtab_duplicate(struct hashtab *new, const struct hashtab *orig,
memset(new, 0, sizeof(*new));
- new->htable = kzalloc_objs(*new->htable, orig->size, GFP_KERNEL);
+ new->htable = kzalloc_objs(*new->htable, orig->size);
if (!new->htable)
return -ENOMEM;
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
index a96c671d0d51..661322ff1669 100644
--- a/security/selinux/ss/policydb.c
+++ b/security/selinux/ss/policydb.c
@@ -390,7 +390,7 @@ static int roles_init(struct policydb *p)
int rc;
struct role_datum *role;
- role = kzalloc_obj(*role, GFP_KERNEL);
+ role = kzalloc_obj(*role);
if (!role)
return -ENOMEM;
@@ -1130,7 +1130,7 @@ static int perm_read(struct policydb *p, struct symtab *s, struct policy_file *f
__le32 buf[2];
u32 len;
- perdatum = kzalloc_obj(*perdatum, GFP_KERNEL);
+ perdatum = kzalloc_obj(*perdatum);
if (!perdatum)
return -ENOMEM;
@@ -1163,7 +1163,7 @@ static int common_read(struct policydb *p, struct symtab *s, struct policy_file
u32 i, len, nel;
int rc;
- comdatum = kzalloc_obj(*comdatum, GFP_KERNEL);
+ comdatum = kzalloc_obj(*comdatum);
if (!comdatum)
return -ENOMEM;
@@ -1236,7 +1236,7 @@ static int read_cons_helper(struct policydb *p, struct constraint_node **nodep,
lc = NULL;
for (i = 0; i < ncons; i++) {
- c = kzalloc_obj(*c, GFP_KERNEL);
+ c = kzalloc_obj(*c);
if (!c)
return -ENOMEM;
@@ -1253,7 +1253,7 @@ static int read_cons_helper(struct policydb *p, struct constraint_node **nodep,
le = NULL;
depth = -1;
for (j = 0; j < nexpr; j++) {
- e = kzalloc_obj(*e, GFP_KERNEL);
+ e = kzalloc_obj(*e);
if (!e)
return -ENOMEM;
@@ -1327,7 +1327,7 @@ static int class_read(struct policydb *p, struct symtab *s, struct policy_file *
u32 i, len, len2, ncons, nel;
int rc;
- cladatum = kzalloc_obj(*cladatum, GFP_KERNEL);
+ cladatum = kzalloc_obj(*cladatum);
if (!cladatum)
return -ENOMEM;
@@ -1425,7 +1425,7 @@ static int role_read(struct policydb *p, struct symtab *s, struct policy_file *f
__le32 buf[3];
u32 len;
- role = kzalloc_obj(*role, GFP_KERNEL);
+ role = kzalloc_obj(*role);
if (!role)
return -ENOMEM;
@@ -1482,7 +1482,7 @@ static int type_read(struct policydb *p, struct symtab *s, struct policy_file *f
__le32 buf[4];
u32 len;
- typdatum = kzalloc_obj(*typdatum, GFP_KERNEL);
+ typdatum = kzalloc_obj(*typdatum);
if (!typdatum)
return -ENOMEM;
@@ -1556,7 +1556,7 @@ static int user_read(struct policydb *p, struct symtab *s, struct policy_file *f
__le32 buf[3];
u32 len;
- usrdatum = kzalloc_obj(*usrdatum, GFP_KERNEL);
+ usrdatum = kzalloc_obj(*usrdatum);
if (!usrdatum)
return -ENOMEM;
@@ -1606,7 +1606,7 @@ static int sens_read(struct policydb *p, struct symtab *s, struct policy_file *f
__le32 buf[2];
u32 len;
- levdatum = kzalloc_obj(*levdatum, GFP_KERNEL);
+ levdatum = kzalloc_obj(*levdatum);
if (!levdatum)
return -ENOMEM;
@@ -1642,7 +1642,7 @@ static int cat_read(struct policydb *p, struct symtab *s, struct policy_file *fp
__le32 buf[3];
u32 len;
- catdatum = kzalloc_obj(*catdatum, GFP_KERNEL);
+ catdatum = kzalloc_obj(*catdatum);
if (!catdatum)
return -ENOMEM;
@@ -1862,7 +1862,7 @@ static int range_read(struct policydb *p, struct policy_file *fp)
for (i = 0; i < nel; i++) {
rc = -ENOMEM;
- rt = kzalloc_obj(*rt, GFP_KERNEL);
+ rt = kzalloc_obj(*rt);
if (!rt)
goto out;
@@ -1887,7 +1887,7 @@ static int range_read(struct policydb *p, struct policy_file *fp)
goto out;
rc = -ENOMEM;
- r = kzalloc_obj(*r, GFP_KERNEL);
+ r = kzalloc_obj(*r);
if (!r)
goto out;
@@ -1963,7 +1963,7 @@ static int filename_trans_read_helper_compat(struct policydb *p, struct policy_f
}
if (!datum) {
rc = -ENOMEM;
- datum = kmalloc_obj(*datum, GFP_KERNEL);
+ datum = kmalloc_obj(*datum);
if (!datum)
goto out;
@@ -2038,7 +2038,7 @@ static int filename_trans_read_helper(struct policydb *p, struct policy_file *fp
dst = &first;
for (i = 0; i < ndatum; i++) {
rc = -ENOMEM;
- datum = kmalloc_obj(*datum, GFP_KERNEL);
+ datum = kmalloc_obj(*datum);
if (!datum)
goto out;
@@ -2060,7 +2060,7 @@ static int filename_trans_read_helper(struct policydb *p, struct policy_file *fp
}
rc = -ENOMEM;
- ft = kmalloc_obj(*ft, GFP_KERNEL);
+ ft = kmalloc_obj(*ft);
if (!ft)
goto out;
@@ -2153,7 +2153,7 @@ static int genfs_read(struct policydb *p, struct policy_file *fp)
len = le32_to_cpu(buf[0]);
rc = -ENOMEM;
- newgenfs = kzalloc_obj(*newgenfs, GFP_KERNEL);
+ newgenfs = kzalloc_obj(*newgenfs);
if (!newgenfs)
goto out;
@@ -2192,7 +2192,7 @@ static int genfs_read(struct policydb *p, struct policy_file *fp)
len = le32_to_cpu(buf[0]);
rc = -ENOMEM;
- newc = kzalloc_obj(*newc, GFP_KERNEL);
+ newc = kzalloc_obj(*newc);
if (!newc)
goto out;
@@ -2264,7 +2264,7 @@ static int ocontext_read(struct policydb *p,
l = NULL;
for (j = 0; j < nel; j++) {
rc = -ENOMEM;
- c = kzalloc_obj(*c, GFP_KERNEL);
+ c = kzalloc_obj(*c);
if (!c)
goto out;
if (l)
@@ -2621,12 +2621,12 @@ int policydb_read(struct policydb *p, struct policy_file *fp)
goto bad;
for (i = 0; i < nel; i++) {
rc = -ENOMEM;
- rtk = kmalloc_obj(*rtk, GFP_KERNEL);
+ rtk = kmalloc_obj(*rtk);
if (!rtk)
goto bad;
rc = -ENOMEM;
- rtd = kmalloc_obj(*rtd, GFP_KERNEL);
+ rtd = kmalloc_obj(*rtd);
if (!rtd)
goto bad;
@@ -2669,7 +2669,7 @@ int policydb_read(struct policydb *p, struct policy_file *fp)
lra = NULL;
for (i = 0; i < nel; i++) {
rc = -ENOMEM;
- ra = kzalloc_obj(*ra, GFP_KERNEL);
+ ra = kzalloc_obj(*ra);
if (!ra)
goto bad;
if (lra)
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index 6f20e941c059..e8e7ccbd1e44 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -2312,11 +2312,11 @@ int security_load_policy(void *data, size_t len,
int rc = 0;
struct policy_file file = { data, len }, *fp = &file;
- newpolicy = kzalloc_obj(*newpolicy, GFP_KERNEL);
+ newpolicy = kzalloc_obj(*newpolicy);
if (!newpolicy)
return -ENOMEM;
- newpolicy->sidtab = kzalloc_obj(*newpolicy->sidtab, GFP_KERNEL);
+ newpolicy->sidtab = kzalloc_obj(*newpolicy->sidtab);
if (!newpolicy->sidtab) {
rc = -ENOMEM;
goto err_policy;
@@ -2360,7 +2360,7 @@ int security_load_policy(void *data, size_t len,
* in the new SID table.
*/
- convert_data = kmalloc_obj(*convert_data, GFP_KERNEL);
+ convert_data = kmalloc_obj(*convert_data);
if (!convert_data) {
rc = -ENOMEM;
goto err_free_isids;
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index e2add0c8c739..98af9d7b9434 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -562,7 +562,7 @@ static int smack_add_opt(int token, const char *s, void **mnt_opts)
struct smack_known *skp;
if (!opts) {
- opts = kzalloc_obj(struct smack_mnt_opts, GFP_KERNEL);
+ opts = kzalloc_obj(struct smack_mnt_opts);
if (!opts)
return -ENOMEM;
*mnt_opts = opts;
@@ -622,7 +622,7 @@ static int smack_fs_context_submount(struct fs_context *fc,
struct smack_mnt_opts *ctx;
struct inode_smack *isp;
- ctx = kzalloc_obj(*ctx, GFP_KERNEL);
+ ctx = kzalloc_obj(*ctx);
if (!ctx)
return -ENOMEM;
fc->security = ctx;
@@ -673,7 +673,7 @@ static int smack_fs_context_dup(struct fs_context *fc,
if (!src)
return 0;
- fc->security = kzalloc_obj(struct smack_mnt_opts, GFP_KERNEL);
+ fc->security = kzalloc_obj(struct smack_mnt_opts);
if (!fc->security)
return -ENOMEM;
@@ -2817,7 +2817,7 @@ static void smk_ipv6_port_label(struct socket *sock, struct sockaddr *address)
/*
* A new port entry is required.
*/
- spp = kzalloc_obj(*spp, GFP_KERNEL);
+ spp = kzalloc_obj(*spp);
if (spp == NULL)
return;
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
index 35b98f11e32d..6e62dcb36f74 100644
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -1249,7 +1249,7 @@ static ssize_t smk_write_net4addr(struct file *file, const char __user *buf,
smk_netlabel_audit_set(&audit_info);
if (found == 0) {
- snp = kzalloc_obj(*snp, GFP_KERNEL);
+ snp = kzalloc_obj(*snp);
if (snp == NULL)
rc = -ENOMEM;
else {
@@ -1526,7 +1526,7 @@ static ssize_t smk_write_net6addr(struct file *file, const char __user *buf,
break;
}
if (found == 0) {
- snp = kzalloc_obj(*snp, GFP_KERNEL);
+ snp = kzalloc_obj(*snp);
if (snp == NULL)
rc = -ENOMEM;
else {
@@ -1970,7 +1970,7 @@ static int smk_parse_label_list(char *data, struct list_head *list)
if (IS_ERR(skp))
return PTR_ERR(skp);
- sklep = kzalloc_obj(*sklep, GFP_KERNEL);
+ sklep = kzalloc_obj(*sklep);
if (sklep == NULL)
return -ENOMEM;
diff --git a/security/yama/yama_lsm.c b/security/yama/yama_lsm.c
index 57fd421f8c31..cef3776cf3b2 100644
--- a/security/yama/yama_lsm.c
+++ b/security/yama/yama_lsm.c
@@ -143,7 +143,7 @@ static int yama_ptracer_add(struct task_struct *tracer,
{
struct ptrace_relation *relation, *added;
- added = kmalloc_obj(*added, GFP_KERNEL);
+ added = kmalloc_obj(*added);
if (!added)
return -ENOMEM;