Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1513396 > unrolled thread
| Started by | Eugene Korenevsky <ekorenevsky@gmail.com> |
|---|---|
| First post | 2016-11-01 18:40 +0100 |
| Last post | 2016-11-02 07:00 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] EFI loader: remove dead code Eugene Korenevsky <ekorenevsky@gmail.com> - 2016-11-01 18:40 +0100
Re: [PATCH] EFI loader: remove dead code Linn Crosetto <linn@hpe.com> - 2016-11-02 00:10 +0100
Re: [PATCH] EFI loader: remove dead code Eugene Korenevsky <ekorenevsky@gmail.com> - 2016-11-02 07:00 +0100
| From | Eugene Korenevsky <ekorenevsky@gmail.com> |
|---|---|
| Date | 2016-11-01 18:40 +0100 |
| Subject | [PATCH] EFI loader: remove dead code |
| Message-ID | <syLct-3dm-7@gated-at.bofh.it> |
*e820ext is always NULL in 'alloc_e820ext()' (see the code of 'exit_boot()').
Therefore the 'if' condition is always false and the entire 'if' statement is
pointless. Remove it.
---
arch/x86/boot/compressed/eboot.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index cc69e37..edfd4d6 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -956,12 +956,6 @@ static efi_status_t alloc_e820ext(u32 nr_desc, struct setup_data **e820ext,
size = sizeof(struct setup_data) +
sizeof(struct e820entry) * nr_desc;
- if (*e820ext) {
- efi_call_early(free_pool, *e820ext);
- *e820ext = NULL;
- *e820ext_size = 0;
- }
-
status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
size, (void **)e820ext);
if (status == EFI_SUCCESS)
--
2.10.2
[toc] | [next] | [standalone]
| From | Linn Crosetto <linn@hpe.com> |
|---|---|
| Date | 2016-11-02 00:10 +0100 |
| Message-ID | <syQlP-6Eu-7@gated-at.bofh.it> |
| In reply to | #1513396 |
On Tue, Nov 01, 2016 at 08:38:08PM +0300, Eugene Korenevsky wrote:
> *e820ext is always NULL in 'alloc_e820ext()' (see the code of 'exit_boot()').
> Therefore the 'if' condition is always false and the entire 'if' statement is
> pointless. Remove it.
>
> ---
> arch/x86/boot/compressed/eboot.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
> index cc69e37..edfd4d6 100644
> --- a/arch/x86/boot/compressed/eboot.c
> +++ b/arch/x86/boot/compressed/eboot.c
> @@ -956,12 +956,6 @@ static efi_status_t alloc_e820ext(u32 nr_desc, struct setup_data **e820ext,
> size = sizeof(struct setup_data) +
> sizeof(struct e820entry) * nr_desc;
>
> - if (*e820ext) {
> - efi_call_early(free_pool, *e820ext);
> - *e820ext = NULL;
> - *e820ext_size = 0;
> - }
> -
I agree with your reading of the code. On the other hand, alloc_e820ext()
has no knowledge of the 'first' flag used in exit_boot_func() so the call to
free provides some assurance that memory isn't leaked if the calling code is
changed.
If the caller is responsible for freeing the memory in such a case, then
alloc_e820ext() should at least return an error.
--
Linn
[toc] | [prev] | [next] | [standalone]
| From | Eugene Korenevsky <ekorenevsky@gmail.com> |
|---|---|
| Date | 2016-11-02 07:00 +0100 |
| Message-ID | <syWKB-2aW-7@gated-at.bofh.it> |
| In reply to | #1513559 |
Applied your notice. Sent v2 patch. -- Eugene
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web