[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Call a module's init function only after the module is succe
From: |
Pavel Roskin |
Subject: |
Re: [PATCH] Call a module's init function only after the module is successfully added |
Date: |
Tue, 21 Jul 2009 16:02:48 -0400 |
On Mon, 2009-07-20 at 21:00 -0700, Joe Auricchio wrote:
> Hi,
>
> * kern/dl.c (grub_dl_load_core): Call grub_dl_call_init only after
> successful grub_dl_add
>
> With this patch the module's init function will no longer be called:
> - if the module is already loaded
> - if malloc fails in grub_dl_add
> - before the module is added to grub_dl_head
>
> The first two are errors and cause the load to abort. The module
> shouldn't try to init if it's only going to abort. I don't know much
> about grub_dl_head, so I don't know if #3 could have caused problems.
I have no objections.
By the way, kern/dl.c have some unused functions (grub_dl_unload_all).
Also, it looks like the memory for the module information (grub_dl_t) is
allocated twice - first in grub_dl_load_core(), then in grub_dl_add() as
part of grub_dl_list_t.
grub_dl_load() can return either memory from the list that shouldn't be
freed by the caller, or the result of grub_dl_load_file(), which is
allocated and is not referenced anywhere.
--
Regards,
Pavel Roskin