On Fri, 2023-12-15 at 17:07 -0800, Tushar Sugandhi wrote:
> Refactor ima_dump_measurement_list() to move the memory allocation part
> to a separate function ima_alloc_kexec_file_buf() to allocate buffer of
> size 'kexec_segment_size' at kexec 'load'.  Make the local variables in
> function ima_dump_measurement_list() global, so that they can be accessed
> from ima_alloc_kexec_file_buf().  

Only ima_kexec_file is being moved and does not need to be global, but
should be defined as local static.

> Make necessary changes to the function
> ima_add_kexec_buffer() to call the above two functions.
> 
> Signed-off-by: Tushar Sugandhi <[email protected]>
> ---
>  security/integrity/ima/ima_kexec.c | 96 +++++++++++++++++++++---------
>  1 file changed, 67 insertions(+), 29 deletions(-)
> 
> diff --git a/security/integrity/ima/ima_kexec.c 
> b/security/integrity/ima/ima_kexec.c
> index 419dc405c831..ae27101d0615 100644
> --- a/security/integrity/ima/ima_kexec.c
> +++ b/security/integrity/ima/ima_kexec.c
> @@ -15,62 +15,93 @@
>  #include "ima.h"
>  
>  #ifdef CONFIG_IMA_KEXEC
> +struct seq_file ima_kexec_file;

^static.

> +void ima_free_kexec_file_buf(struct seq_file *sf)

^static

> +{
> +     vfree(sf->buf);
> +     sf->buf = NULL;
> +     sf->size = 0;
> +     sf->read_pos = 0;
> +     sf->count = 0;

--  
thanks,

Mimi


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Reply via email to