]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
dm-ima: drop a useless argument
authorMikulas Patocka <mpatocka@redhat.com>
Mon, 11 Aug 2025 11:13:28 +0000 (13:13 +0200)
committerMikulas Patocka <mpatocka@redhat.com>
Tue, 19 Aug 2025 09:12:50 +0000 (11:12 +0200)
The "gfp_t flags" is always GFP_KERNEL, so it can be removed.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
drivers/md/dm-ima.c

index f5c0ecc7cb0bdc06298edbd9d0408c8fad0d2218..efb3cd4f9cd453011b7cc0e78933a26718758c73 100644 (file)
@@ -45,7 +45,7 @@ static void fix_separator_chars(char **buf)
 /*
  * Internal function to allocate memory for IMA measurements.
  */
-static void *dm_ima_alloc(size_t len, gfp_t flags, bool noio)
+static void *dm_ima_alloc(size_t len, bool noio)
 {
        unsigned int noio_flag;
        void *ptr;
@@ -53,7 +53,7 @@ static void *dm_ima_alloc(size_t len, gfp_t flags, bool noio)
        if (noio)
                noio_flag = memalloc_noio_save();
 
-       ptr = kzalloc(len, flags);
+       ptr = kzalloc(len, GFP_KERNEL);
 
        if (noio)
                memalloc_noio_restore(noio_flag);
@@ -68,13 +68,13 @@ static int dm_ima_alloc_and_copy_name_uuid(struct mapped_device *md, char **dev_
                                           char **dev_uuid, bool noio)
 {
        int r;
-       *dev_name = dm_ima_alloc(DM_NAME_LEN*2, GFP_KERNEL, noio);
+       *dev_name = dm_ima_alloc(DM_NAME_LEN*2, noio);
        if (!(*dev_name)) {
                r = -ENOMEM;
                goto error;
        }
 
-       *dev_uuid = dm_ima_alloc(DM_UUID_LEN*2, GFP_KERNEL, noio);
+       *dev_uuid = dm_ima_alloc(DM_UUID_LEN*2, noio);
        if (!(*dev_uuid)) {
                r = -ENOMEM;
                goto error;
@@ -109,7 +109,7 @@ static int dm_ima_alloc_and_copy_device_data(struct mapped_device *md, char **de
        if (r)
                return r;
 
-       *device_data = dm_ima_alloc(DM_IMA_DEVICE_BUF_LEN, GFP_KERNEL, noio);
+       *device_data = dm_ima_alloc(DM_IMA_DEVICE_BUF_LEN, noio);
        if (!(*device_data)) {
                r = -ENOMEM;
                goto error;
@@ -153,7 +153,7 @@ static int dm_ima_alloc_and_copy_capacity_str(struct mapped_device *md, char **c
 
        capacity = get_capacity(md->disk);
 
-       *capacity_str = dm_ima_alloc(DM_IMA_DEVICE_CAPACITY_BUF_LEN, GFP_KERNEL, noio);
+       *capacity_str = dm_ima_alloc(DM_IMA_DEVICE_CAPACITY_BUF_LEN, noio);
        if (!(*capacity_str))
                return -ENOMEM;
 
@@ -193,15 +193,15 @@ void dm_ima_measure_on_table_load(struct dm_table *table, unsigned int status_fl
        const size_t hash_alg_prefix_len = strlen(DM_IMA_TABLE_HASH_ALG) + 1;
        char table_load_event_name[] = "dm_table_load";
 
-       ima_buf = dm_ima_alloc(DM_IMA_MEASUREMENT_BUF_LEN, GFP_KERNEL, noio);
+       ima_buf = dm_ima_alloc(DM_IMA_MEASUREMENT_BUF_LEN, noio);
        if (!ima_buf)
                return;
 
-       target_metadata_buf = dm_ima_alloc(DM_IMA_TARGET_METADATA_BUF_LEN, GFP_KERNEL, noio);
+       target_metadata_buf = dm_ima_alloc(DM_IMA_TARGET_METADATA_BUF_LEN, noio);
        if (!target_metadata_buf)
                goto error;
 
-       target_data_buf = dm_ima_alloc(DM_IMA_TARGET_DATA_BUF_LEN, GFP_KERNEL, noio);
+       target_data_buf = dm_ima_alloc(DM_IMA_TARGET_DATA_BUF_LEN, noio);
        if (!target_data_buf)
                goto error;
 
@@ -216,7 +216,7 @@ void dm_ima_measure_on_table_load(struct dm_table *table, unsigned int status_fl
 
        shash->tfm = tfm;
        digest_size = crypto_shash_digestsize(tfm);
-       digest = dm_ima_alloc(digest_size, GFP_KERNEL, noio);
+       digest = dm_ima_alloc(digest_size, noio);
        if (!digest)
                goto error;
 
@@ -325,7 +325,7 @@ void dm_ima_measure_on_table_load(struct dm_table *table, unsigned int status_fl
        if (r < 0)
                goto error;
 
-       digest_buf = dm_ima_alloc((digest_size*2) + hash_alg_prefix_len + 1, GFP_KERNEL, noio);
+       digest_buf = dm_ima_alloc((digest_size*2) + hash_alg_prefix_len + 1, noio);
 
        if (!digest_buf)
                goto error;
@@ -375,7 +375,7 @@ void dm_ima_measure_on_device_resume(struct mapped_device *md, bool swap)
        bool nodata = true;
        int capacity_len;
 
-       device_table_data = dm_ima_alloc(DM_IMA_DEVICE_BUF_LEN, GFP_KERNEL, noio);
+       device_table_data = dm_ima_alloc(DM_IMA_DEVICE_BUF_LEN, noio);
        if (!device_table_data)
                return;
 
@@ -484,7 +484,7 @@ void dm_ima_measure_on_device_remove(struct mapped_device *md, bool remove_all)
        bool nodata = true;
        int capacity_len;
 
-       device_table_data = dm_ima_alloc(DM_IMA_DEVICE_BUF_LEN*2, GFP_KERNEL, noio);
+       device_table_data = dm_ima_alloc(DM_IMA_DEVICE_BUF_LEN*2, noio);
        if (!device_table_data)
                goto exit;
 
@@ -604,7 +604,7 @@ void dm_ima_measure_on_table_clear(struct mapped_device *md, bool new_map)
        bool nodata = true;
        int capacity_len;
 
-       device_table_data = dm_ima_alloc(DM_IMA_DEVICE_BUF_LEN, GFP_KERNEL, noio);
+       device_table_data = dm_ima_alloc(DM_IMA_DEVICE_BUF_LEN, noio);
        if (!device_table_data)
                return;
 
@@ -705,7 +705,7 @@ void dm_ima_measure_on_device_rename(struct mapped_device *md)
        if (dm_ima_alloc_and_copy_name_uuid(md, &new_dev_name, &new_dev_uuid, noio))
                goto error;
 
-       combined_device_data = dm_ima_alloc(DM_IMA_DEVICE_BUF_LEN * 2, GFP_KERNEL, noio);
+       combined_device_data = dm_ima_alloc(DM_IMA_DEVICE_BUF_LEN * 2, noio);
        if (!combined_device_data)
                goto error;