Re: [PATCH 0/2] commands/efi: Fix sevral memory leaks

2025-05-20 Thread khaalid cali
From: Khalid Ali I added Daniel review tag, as he requested from me by privious thread. He reviewed this patch from another thread. Best regards, khaalid ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel

[PATCH 2/2 ] loader/efi/linux: Fix memory leak

2025-05-20 Thread khaalid cali
Free mempath in case of failures. Signed-off-by: Khalid Ali --- grub-core/loader/efi/linux.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c index 78ea07ca8..e1f3d5f48 100644 --- a/grub-core/loader/efi/linux.c ++

[PATCH 1/2] disk/efi/efidisk: Fix memory leak

2025-05-20 Thread khaalid cali
Free "dp" in case of failure. Signed-off-by: Khalid Ali --- grub-core/disk/efi/efidisk.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c index 3b5ed5691..1db29880a 100644 --- a/grub-core/disk/efi/efidisk.c +++ b/grub-core/dis

[PATCH 0/2] commands/efi: Fix sevral memory leaks

2025-05-20 Thread khaalid cali
"handles" that "grub_efi_locate_handles" was allocated with "grub_malloc" wasn't being freed. Signed-off-by: Khalid Ali Reviewed-by: Daniel Kiper --- grub-core/commands/efi/lsefi.c | 1 + grub-core/commands/efi/tpm.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/grub-core/commands/e

[RFC PATCH 2/2] include/efi/efi: Add the prototype

2025-05-18 Thread khaalid cali
From: khaalid The function prototype. Signed-off-by: khaalid --- include/grub/efi/efi.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h index a5cd99e5a..3c38e2834 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -115,6 +

[PATCH 1/2] include/efi/api: Complete UEFI status codes

2025-05-18 Thread khaalid cali
From: khaalid As the the current spec UEFI 2.11 add remaining status codes. The first patch set of this series accounts for. Signed-off-by: Khalid Ali --- include/grub/efi/api.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h index b686

[RFC PATCH 0/2] kern/efi: Make centralized UEFI error message printer

2025-05-18 Thread khaalid cali
From: khaalid This RFC patch introduces a UEFI error message printer that translates UEFI status codes from hexadecimal values into human-readable strings. The idea is inspired by the GNU C Library's "perror()" function, which translates "errno" values into descriptive error messages. Similar

[RESEND PATCH 3/3] commands/efi/tmp: Fix memory leak

2025-05-16 Thread khaalid cali
From: khaalid Free handles probably before return. Signed-off-by: Khalid Ali --- grub-core/commands/efi/tpm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/grub-core/commands/efi/tpm.c b/grub-core/commands/efi/tpm.c index cbac69866..cb39b7bba 100644 --- a/grub-core/commands/efi/tpm.c +

[PATCH v2 2/3] loader/efi/linux: Fix memory leak

2025-05-16 Thread khaalid cali
From: khaalid Free "mempath" in case of failures. Signed-off-by: Khalid Ali --- grub-core/loader/efi/linux.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c index 7c7db3e3a..507d3a343 100644 --- a/grub-core/l

[PATCH v2 0/3] commands/efi/lsefi: Fix memory leak

2025-05-16 Thread khaalid cali
From: khaalid "handles" that "grub_efi_locate_handles" was allocated with "grub_malloc" wasn't being freed. Signed-off-by: Khalid Ali --- grub-core/commands/efi/lsefi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/commands/efi/lsefi.c b/grub-core/commands/efi/

Re: Fwd [PATCH] efi/tpcm: Add TPCM module support

2025-05-15 Thread khaalid cali
From: Khalid Ali > TPCM(Trusted Platform Control Module) is a Chinese standard and has similar > function > to tpm, but tpcm adds the function of active monitoring and control to the > system. > It can realize active startup measurement when the system starts,as well as > dynamic > measurement

[PATCH 2/2] disk/efi/efidisk: Fix memory leak

2025-05-13 Thread khaalid cali
From: khaalid On two places if `grub_efi_find_last_device_path` fails, then `dp` is leaked. Signed-off-by: Khalid Ali --- grub-core/disk/efi/efidisk.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c index 3b5ed5691..6c6fa374

[PATCH 1/2] loader/efi/linux: Fix memory leak

2025-05-13 Thread khaalid cali
From: khaalid It was forgotten to free mempath entirely. Signed-off-by: Khalid Ali --- grub-core/loader/efi/linux.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c index b45a3cc61..7c7db3e3a 100644 --- a/gr

[PATCH 0/2] commands/efi/lsefi: Fix memory leak

2025-05-13 Thread khaalid cali
From: khaalid It was forgotten to free `handles` array of handles returned by `grub_efi_locate_handle`. This is quite a large amount of memory, it depends how many handles being returned which can be hundrends. Signed-off-by: Khalid Ali --- grub-core/commands/efi/lsefi.c | 2 +- 1 file change

[PATCH v3 0/1] loader/efi/chainloader: Enhance error message of chainloader command

2025-05-12 Thread khaalid cali
From: khaalid Well, i think the hex option is simpler in terms of code. Or maybe we need to have centralized function for all UEFI error messages, however this will complicate things a little bit as it requires modifications. Just thought maybe we can extract high bit and treat like integer, thu

[PATCH v3 1/1] loader/efi/linux: Enhance error message of linux command

2025-05-12 Thread khaalid cali
From: khaalid As said in my privious patch. The error message "cannot start image" seems better than "start_imaged returned ..", to make it consistent with the other one. Signed-off-by: khalid Ali --- grub-core/loader/efi/linux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff

[PATCH v6] commands/efi: dump all uefi runtime variables.

2025-05-12 Thread khaalid cali
From: khaalid Hi Vladimir 'phcoder' Serbinenko, I realize this patch is taking longer than expected, and I’d like to avoid more back-and-forths that take time from both of us. Would it be possible for us to work through the remaining points together more directly or clarify the final expectatio

[PATCH v5] commands/efi: dump all uefi runtime variables

2025-05-12 Thread khaalid cali
From: khaalid > Vladimir 'phcoder' Serbinenko wrote: > Please have a look at how to handle errors with realloc. You need to keep a > copy of old pointer in case you have to free it. Some places in our codebase > have similar memory leaks but it'> s not a reason to introduce more. Well, i follo

[PATCH v4] commands/efi: add command to dump all uefi runtime variables

2025-05-11 Thread khaalid cali
From: khaalid I followed the suggestion and implemented the option parsing using extcmd. However, I feel this command is not ideal to have any arguments. Similar commands like lsefi, lsefimmap, and lsefisystab don’t take arguments—they simply dump data. Since this command also just dumps variabl

[PATCH v3] commands/efi: add command to dump all uefi runtime variables

2025-05-10 Thread khaalid cali
From: khaalid This command is intended to print or dump all UEFI runtime services. The structure will look like efivar tool, since visually most people are familiar with it. If the variable content is string then dump it as string, otherwise for non string variables print them as raw hex; just th

[PATCH v2] commands/efi: add a command to dump all uefi runtime variables

2025-05-10 Thread khaalid cali
From: khaalid This command is intended to print or dump all UEFI runtime services. The structure will look like efivar tool, since visually most people are familiar with it. If the variable content is string then dump it as string, otherwise for non string variables print them as raw hex; just th

[RFC PATCH] commands/efi: add a command to dump all UEFI runtime variables

2025-05-09 Thread khaalid cali
From: khaalid This command is intended to print or dump all UEFI runtime services. The structure will look like efivar tool, since visually most people are familiar with it. If the variable content is string then dump it as string, otherwise for non string variables print them as raw hex; just th