mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
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:
@@ -70,7 +70,7 @@ int af_alg_register_type(const struct af_alg_type *type)
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
node = kmalloc_obj(*node, GFP_KERNEL);
|
||||
node = kmalloc_obj(*node);
|
||||
err = -ENOMEM;
|
||||
if (!node)
|
||||
goto unlock;
|
||||
|
||||
@@ -84,7 +84,7 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval)
|
||||
if (!try_module_get(THIS_MODULE))
|
||||
goto err;
|
||||
|
||||
param = kzalloc_obj(*param, GFP_KERNEL);
|
||||
param = kzalloc_obj(*param);
|
||||
if (!param)
|
||||
goto err_put_module;
|
||||
|
||||
@@ -195,7 +195,7 @@ static int cryptomgr_schedule_test(struct crypto_alg *alg)
|
||||
if (!try_module_get(THIS_MODULE))
|
||||
goto err;
|
||||
|
||||
param = kzalloc_obj(*param, GFP_KERNEL);
|
||||
param = kzalloc_obj(*param);
|
||||
if (!param)
|
||||
goto err_put_module;
|
||||
|
||||
|
||||
@@ -202,7 +202,7 @@ static void *rng_bind(const char *name, u32 type, u32 mask)
|
||||
struct rng_parent_ctx *pctx;
|
||||
struct crypto_rng *rng;
|
||||
|
||||
pctx = kzalloc_obj(*pctx, GFP_KERNEL);
|
||||
pctx = kzalloc_obj(*pctx);
|
||||
if (!pctx)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ struct crypto_larval *crypto_larval_alloc(const char *name, u32 type, u32 mask)
|
||||
{
|
||||
struct crypto_larval *larval;
|
||||
|
||||
larval = kzalloc_obj(*larval, GFP_KERNEL);
|
||||
larval = kzalloc_obj(*larval);
|
||||
if (!larval)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
|
||||
@@ -486,7 +486,7 @@ static struct key_restriction *asymmetric_restriction_alloc(
|
||||
struct key *key)
|
||||
{
|
||||
struct key_restriction *keyres =
|
||||
kzalloc_obj(struct key_restriction, GFP_KERNEL);
|
||||
kzalloc_obj(struct key_restriction);
|
||||
|
||||
if (!keyres)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
@@ -133,16 +133,16 @@ struct pkcs7_message *pkcs7_parse_message(const void *data, size_t datalen)
|
||||
struct pkcs7_message *msg = ERR_PTR(-ENOMEM);
|
||||
int ret;
|
||||
|
||||
ctx = kzalloc_obj(struct pkcs7_parse_context, GFP_KERNEL);
|
||||
ctx = kzalloc_obj(struct pkcs7_parse_context);
|
||||
if (!ctx)
|
||||
goto out_no_ctx;
|
||||
ctx->msg = kzalloc_obj(struct pkcs7_message, GFP_KERNEL);
|
||||
ctx->msg = kzalloc_obj(struct pkcs7_message);
|
||||
if (!ctx->msg)
|
||||
goto out_no_msg;
|
||||
ctx->sinfo = kzalloc_obj(struct pkcs7_signed_info, GFP_KERNEL);
|
||||
ctx->sinfo = kzalloc_obj(struct pkcs7_signed_info);
|
||||
if (!ctx->sinfo)
|
||||
goto out_no_sinfo;
|
||||
ctx->sinfo->sig = kzalloc_obj(struct public_key_signature, GFP_KERNEL);
|
||||
ctx->sinfo->sig = kzalloc_obj(struct public_key_signature);
|
||||
if (!ctx->sinfo->sig)
|
||||
goto out_no_sig;
|
||||
|
||||
@@ -728,10 +728,10 @@ int pkcs7_note_signed_info(void *context, size_t hdrlen,
|
||||
sinfo->index = ++ctx->sinfo_index;
|
||||
*ctx->ppsinfo = sinfo;
|
||||
ctx->ppsinfo = &sinfo->next;
|
||||
ctx->sinfo = kzalloc_obj(struct pkcs7_signed_info, GFP_KERNEL);
|
||||
ctx->sinfo = kzalloc_obj(struct pkcs7_signed_info);
|
||||
if (!ctx->sinfo)
|
||||
return -ENOMEM;
|
||||
ctx->sinfo->sig = kzalloc_obj(struct public_key_signature, GFP_KERNEL);
|
||||
ctx->sinfo->sig = kzalloc_obj(struct public_key_signature);
|
||||
if (!ctx->sinfo->sig)
|
||||
return -ENOMEM;
|
||||
return 0;
|
||||
|
||||
@@ -103,7 +103,7 @@ static struct public_key *pkcs8_parse(const void *data, size_t datalen)
|
||||
memset(&ctx, 0, sizeof(ctx));
|
||||
|
||||
ret = -ENOMEM;
|
||||
ctx.pub = kzalloc_obj(struct public_key, GFP_KERNEL);
|
||||
ctx.pub = kzalloc_obj(struct public_key);
|
||||
if (!ctx.pub)
|
||||
goto error;
|
||||
|
||||
|
||||
@@ -65,16 +65,16 @@ struct x509_certificate *x509_cert_parse(const void *data, size_t datalen)
|
||||
struct asymmetric_key_id *kid;
|
||||
long ret;
|
||||
|
||||
cert = kzalloc_obj(struct x509_certificate, GFP_KERNEL);
|
||||
cert = kzalloc_obj(struct x509_certificate);
|
||||
if (!cert)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
cert->pub = kzalloc_obj(struct public_key, GFP_KERNEL);
|
||||
cert->pub = kzalloc_obj(struct public_key);
|
||||
if (!cert->pub)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
cert->sig = kzalloc_obj(struct public_key_signature, GFP_KERNEL);
|
||||
cert->sig = kzalloc_obj(struct public_key_signature);
|
||||
if (!cert->sig)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
ctx = kzalloc_obj(struct x509_parse_context, GFP_KERNEL);
|
||||
ctx = kzalloc_obj(struct x509_parse_context);
|
||||
if (!ctx)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
|
||||
p = bin2hex(p, q, srlen);
|
||||
*p = 0;
|
||||
|
||||
kids = kmalloc_obj(struct asymmetric_key_ids, GFP_KERNEL);
|
||||
kids = kmalloc_obj(struct asymmetric_key_ids);
|
||||
if (!kids)
|
||||
return -ENOMEM;
|
||||
kids->id[0] = cert->id;
|
||||
|
||||
@@ -1522,7 +1522,7 @@ static int drbg_init_sym_kernel(struct drbg_state *drbg)
|
||||
unsigned int alignmask;
|
||||
char ctr_name[CRYPTO_MAX_ALG_NAME];
|
||||
|
||||
aeskey = kzalloc_obj(*aeskey, GFP_KERNEL);
|
||||
aeskey = kzalloc_obj(*aeskey);
|
||||
if (!aeskey)
|
||||
return -ENOMEM;
|
||||
drbg->priv_data = aeskey;
|
||||
@@ -1761,7 +1761,7 @@ static inline int __init drbg_healthcheck_sanity(void)
|
||||
drbg_convert_tfm_core("drbg_nopr_hmac_sha512", &coreref, &pr);
|
||||
#endif
|
||||
|
||||
drbg = kzalloc_obj(struct drbg_state, GFP_KERNEL);
|
||||
drbg = kzalloc_obj(struct drbg_state);
|
||||
if (!drbg)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ struct ecc_point *ecc_alloc_point(unsigned int ndigits)
|
||||
if (!ndigits)
|
||||
return NULL;
|
||||
|
||||
p = kmalloc_obj(*p, GFP_KERNEL);
|
||||
p = kmalloc_obj(*p);
|
||||
if (!p)
|
||||
return NULL;
|
||||
|
||||
|
||||
@@ -1098,7 +1098,7 @@ static int __init crypto_gcm_module_init(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
gcm_zeroes = kzalloc_obj(*gcm_zeroes, GFP_KERNEL);
|
||||
gcm_zeroes = kzalloc_obj(*gcm_zeroes);
|
||||
if (!gcm_zeroes)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ struct simd_skcipher_alg *simd_skcipher_create_compat(struct skcipher_alg *ialg,
|
||||
struct skcipher_alg *alg;
|
||||
int err;
|
||||
|
||||
salg = kzalloc_obj(*salg, GFP_KERNEL);
|
||||
salg = kzalloc_obj(*salg);
|
||||
if (!salg) {
|
||||
salg = ERR_PTR(-ENOMEM);
|
||||
goto out;
|
||||
@@ -370,7 +370,7 @@ static struct simd_aead_alg *simd_aead_create_compat(struct aead_alg *ialg,
|
||||
struct aead_alg *alg;
|
||||
int err;
|
||||
|
||||
salg = kzalloc_obj(*salg, GFP_KERNEL);
|
||||
salg = kzalloc_obj(*salg);
|
||||
if (!salg) {
|
||||
salg = ERR_PTR(-ENOMEM);
|
||||
goto out;
|
||||
|
||||
@@ -180,7 +180,7 @@ static int test_mb_aead_jiffies(struct test_mb_aead_data *data, int enc,
|
||||
int ret = 0;
|
||||
int *rc;
|
||||
|
||||
rc = kzalloc_objs(*rc, num_mb, GFP_KERNEL);
|
||||
rc = kzalloc_objs(*rc, num_mb);
|
||||
if (!rc)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -207,7 +207,7 @@ static int test_mb_aead_cycles(struct test_mb_aead_data *data, int enc,
|
||||
int i;
|
||||
int *rc;
|
||||
|
||||
rc = kzalloc_objs(*rc, num_mb, GFP_KERNEL);
|
||||
rc = kzalloc_objs(*rc, num_mb);
|
||||
if (!rc)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -270,7 +270,7 @@ static void test_mb_aead_speed(const char *algo, int enc, int secs,
|
||||
else
|
||||
e = "decryption";
|
||||
|
||||
data = kzalloc_objs(*data, num_mb, GFP_KERNEL);
|
||||
data = kzalloc_objs(*data, num_mb);
|
||||
if (!data)
|
||||
goto out_free_iv;
|
||||
|
||||
@@ -997,7 +997,7 @@ static int test_mb_acipher_jiffies(struct test_mb_skcipher_data *data, int enc,
|
||||
int ret = 0;
|
||||
int *rc;
|
||||
|
||||
rc = kzalloc_objs(*rc, num_mb, GFP_KERNEL);
|
||||
rc = kzalloc_objs(*rc, num_mb);
|
||||
if (!rc)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -1024,7 +1024,7 @@ static int test_mb_acipher_cycles(struct test_mb_skcipher_data *data, int enc,
|
||||
int i;
|
||||
int *rc;
|
||||
|
||||
rc = kzalloc_objs(*rc, num_mb, GFP_KERNEL);
|
||||
rc = kzalloc_objs(*rc, num_mb);
|
||||
if (!rc)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -1075,7 +1075,7 @@ static void test_mb_skcipher_speed(const char *algo, int enc, int secs,
|
||||
else
|
||||
e = "decryption";
|
||||
|
||||
data = kzalloc_objs(*data, num_mb, GFP_KERNEL);
|
||||
data = kzalloc_objs(*data, num_mb);
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
|
||||
@@ -739,7 +739,7 @@ static struct cipher_test_sglists *alloc_cipher_test_sglists(void)
|
||||
{
|
||||
struct cipher_test_sglists *tsgls;
|
||||
|
||||
tsgls = kmalloc_obj(*tsgls, GFP_KERNEL);
|
||||
tsgls = kmalloc_obj(*tsgls);
|
||||
if (!tsgls)
|
||||
return NULL;
|
||||
|
||||
@@ -1796,7 +1796,7 @@ static int test_hash_vs_generic_impl(const char *generic_driver,
|
||||
return err;
|
||||
}
|
||||
|
||||
cfg = kzalloc_obj(*cfg, GFP_KERNEL);
|
||||
cfg = kzalloc_obj(*cfg);
|
||||
if (!cfg) {
|
||||
err = -ENOMEM;
|
||||
goto out;
|
||||
@@ -1941,7 +1941,7 @@ static int __alg_test_hash(const struct hash_testvec *vecs,
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
tsgl = kmalloc_obj(*tsgl, GFP_KERNEL);
|
||||
tsgl = kmalloc_obj(*tsgl);
|
||||
if (!tsgl || init_test_sglist(tsgl) != 0) {
|
||||
pr_err("alg: hash: failed to allocate test buffers for %s\n",
|
||||
driver);
|
||||
@@ -2598,7 +2598,7 @@ static int test_aead_slow(const struct alg_test_desc *test_desc,
|
||||
if (noslowtests)
|
||||
return 0;
|
||||
|
||||
ctx = kzalloc_obj(*ctx, GFP_KERNEL);
|
||||
ctx = kzalloc_obj(*ctx);
|
||||
if (!ctx)
|
||||
return -ENOMEM;
|
||||
init_rnd_state(&ctx->rng);
|
||||
@@ -3106,7 +3106,7 @@ static int test_skcipher_vs_generic_impl(const char *generic_driver,
|
||||
return err;
|
||||
}
|
||||
|
||||
cfg = kzalloc_obj(*cfg, GFP_KERNEL);
|
||||
cfg = kzalloc_obj(*cfg);
|
||||
if (!cfg) {
|
||||
err = -ENOMEM;
|
||||
goto out;
|
||||
|
||||
Reference in New Issue
Block a user