dm-ima: drop a useless argument

The "gfp_t flags" is always GFP_KERNEL, so it can be removed.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
This commit is contained in:
Mikulas Patocka 2025-08-11 13:13:28 +02:00
parent c3797175b3
commit d4f00a584b
1 changed files with 15 additions and 15 deletions

View File

@ -45,7 +45,7 @@ static void fix_separator_chars(char **buf)
/* /*
* Internal function to allocate memory for IMA measurements. * 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; unsigned int noio_flag;
void *ptr; void *ptr;
@ -53,7 +53,7 @@ static void *dm_ima_alloc(size_t len, gfp_t flags, bool noio)
if (noio) if (noio)
noio_flag = memalloc_noio_save(); noio_flag = memalloc_noio_save();
ptr = kzalloc(len, flags); ptr = kzalloc(len, GFP_KERNEL);
if (noio) if (noio)
memalloc_noio_restore(noio_flag); 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) char **dev_uuid, bool noio)
{ {
int r; 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)) { if (!(*dev_name)) {
r = -ENOMEM; r = -ENOMEM;
goto error; 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)) { if (!(*dev_uuid)) {
r = -ENOMEM; r = -ENOMEM;
goto error; goto error;
@ -109,7 +109,7 @@ static int dm_ima_alloc_and_copy_device_data(struct mapped_device *md, char **de
if (r) if (r)
return 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)) { if (!(*device_data)) {
r = -ENOMEM; r = -ENOMEM;
goto error; 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 = 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)) if (!(*capacity_str))
return -ENOMEM; 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; const size_t hash_alg_prefix_len = strlen(DM_IMA_TABLE_HASH_ALG) + 1;
char table_load_event_name[] = "dm_table_load"; 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) if (!ima_buf)
return; 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) if (!target_metadata_buf)
goto error; 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) if (!target_data_buf)
goto error; goto error;
@ -216,7 +216,7 @@ void dm_ima_measure_on_table_load(struct dm_table *table, unsigned int status_fl
shash->tfm = tfm; shash->tfm = tfm;
digest_size = crypto_shash_digestsize(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) if (!digest)
goto error; goto error;
@ -325,7 +325,7 @@ void dm_ima_measure_on_table_load(struct dm_table *table, unsigned int status_fl
if (r < 0) if (r < 0)
goto error; 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) if (!digest_buf)
goto error; goto error;
@ -375,7 +375,7 @@ void dm_ima_measure_on_device_resume(struct mapped_device *md, bool swap)
bool nodata = true; bool nodata = true;
int capacity_len; 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) if (!device_table_data)
return; return;
@ -484,7 +484,7 @@ void dm_ima_measure_on_device_remove(struct mapped_device *md, bool remove_all)
bool nodata = true; bool nodata = true;
int capacity_len; 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) if (!device_table_data)
goto exit; goto exit;
@ -604,7 +604,7 @@ void dm_ima_measure_on_table_clear(struct mapped_device *md, bool new_map)
bool nodata = true; bool nodata = true;
int capacity_len; 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) if (!device_table_data)
return; 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)) if (dm_ima_alloc_and_copy_name_uuid(md, &new_dev_name, &new_dev_uuid, noio))
goto error; 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) if (!combined_device_data)
goto error; goto error;