From: Ingo Molnar <mingo@kernel.org>
To: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>,
"H . Peter Anvin" <hpa@zytor.com>,
Jeffrey Hugo <jhugo@codeaurora.org>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org,
Leif Lindholm <leif.lindholm@linaro.org>,
Mark Rutland <mark.rutland@arm.com>,
stable@vger.kernel.org
Subject: Re: [PATCH 2/6] efi/libstub: Allocate headspace in efi_get_memory_map()
Date: Mon, 22 Aug 2016 18:37:25 +0200 [thread overview]
Message-ID: <20160822163724.GA11327@gmail.com> (raw)
In-Reply-To: <1471638904-3494-3-git-send-email-matt@codeblueprint.co.uk>
* Matt Fleming <matt@codeblueprint.co.uk> wrote:
> + efi_boottime_memory_map_t map;
>
> nr_desc = 0;
> e820ext = NULL;
> e820ext_size = 0;
> + map.map = &mem_map;
> + map.map_size = &map_sz;
> + map.desc_size = &desc_size;
> + map.desc_ver = &desc_version;
> + map.key_ptr = &key;
> + map.buff_size = &buff_size;
> + *map->desc_size = sizeof(*m);
> + *map->map_size = *map->desc_size * 32;
> + *map->buff_size = *map->map_size;
> + boot_map.map = (efi_memory_desc_t **)&map.map;
> + boot_map.map_size = &map_size;
> + boot_map.desc_size = &map.desc_size;
> + boot_map.desc_ver = NULL;
> + boot_map.key_ptr = NULL;
> + boot_map.buff_size = &buff_size;
> + boot_map.map = ↦
> + boot_map.map_size = &map_size;
> + boot_map.desc_size = &desc_size;
> + boot_map.desc_ver = NULL;
> + boot_map.key_ptr = NULL;
> + boot_map.buff_size = &buff_size;
> + efi_boottime_memory_map_t boot_map;
> +
> + boot_map.map = ↦
> + boot_map.map_size = &map_size;
> + boot_map.desc_size = &desc_size;
> + boot_map.desc_ver = NULL;
> + boot_map.key_ptr = NULL;
> + boot_map.buff_size = &buff_size;
> + efi_boottime_memory_map_t map;
> +
> + map.map = &runtime_map;
> + map.map_size = &map_size;
> + map.desc_size = &desc_size;
> + map.desc_ver = &desc_ver;
> + map.key_ptr = &mmap_key;
> + map.buff_size = &buff_size;
> + efi_boottime_memory_map_t map;
>
> - status = efi_get_memory_map(sys_table_arg, &memory_map, &map_size,
> - &desc_size, NULL, NULL);
> + map.map = &memory_map;
> + map.map_size = &map_size;
> + map.desc_size = &desc_size;
> + map.desc_ver = NULL;
> + map.key_ptr = NULL;
> + map.buff_size = &buff_size;
That's really ugly - if we do such initializations then at minimum they should be
aligned vertically.
> u32 imagesize;
> } efi_capsule_header_t;
>
> +typedef struct {
> + efi_memory_desc_t **map;
> + unsigned long *map_size;
> + unsigned long *desc_size;
> + u32 *desc_ver;
> + unsigned long *key_ptr;
> + unsigned long *buff_size;
> +} efi_boottime_memory_map_t;
Ditto for structure definitions:
typedef struct {
efi_memory_desc_t **map;
unsigned long *map_size;
unsigned long *desc_size;
u32 *desc_ver;
unsigned long *key_ptr;
unsigned long *buff_size;
} efi_boottime_memory_map_t;
Plus it would be nice to just use a proper structure name instead of a typedef -
such as:
struct efi_boot_memmap {
...
};
(Note that this name is also shorter)
... in the kernel we generally only use typedefs for short, synthetic types -
bigger objects like this should be explicit structs - unless there's some strong
reason to do it via a typedef.
Thanks,
Ingo
next prev parent reply other threads:[~2016-08-22 16:37 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-19 20:34 [GIT PULL 0/6] EFI urgent fixes Matt Fleming
2016-08-19 20:34 ` [PATCH 1/6] efi: Make for_each_efi_memory_desc_in_map() cope with running on Xen Matt Fleming
2016-08-19 20:35 ` [PATCH 2/6] efi/libstub: Allocate headspace in efi_get_memory_map() Matt Fleming
2016-08-22 16:37 ` Ingo Molnar [this message]
2016-08-19 20:35 ` [PATCH 3/6] efi/libstub: Introduce ExitBootServices helper Matt Fleming
[not found] ` <1471638904-3494-4-git-send-email-matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-08-22 16:41 ` Ingo Molnar
2016-08-22 16:41 ` Ingo Molnar
2016-08-19 20:35 ` [PATCH 4/6] efi/libstub: Use efi_exit_boot_services() in FDT Matt Fleming
2016-08-22 16:43 ` Ingo Molnar
2016-08-19 20:35 ` [PATCH 5/6] x86/efi: Use efi_exit_boot_services() Matt Fleming
2016-08-19 20:35 ` [PATCH 6/6] efi/fdt: Fix handling error value in fdt_find_uefi_params Matt Fleming
2016-08-22 16:45 ` Ingo Molnar
[not found] ` <20160822164508.GD11327-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-08-30 10:07 ` Matt Fleming
2016-08-30 10:07 ` Matt Fleming
[not found] ` <20160830100742.GA32579-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-08-30 10:41 ` [PATCH v2] efi: fix " Andrzej Hajda
2016-08-30 10:41 ` Andrzej Hajda
[not found] ` <1472553697-27984-1-git-send-email-a.hajda-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2016-09-05 10:27 ` Matt Fleming
2016-09-05 10:27 ` Matt Fleming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160822163724.GA11327@gmail.com \
--to=mingo@kernel.org \
--cc=ard.biesheuvel@linaro.org \
--cc=hpa@zytor.com \
--cc=jhugo@codeaurora.org \
--cc=leif.lindholm@linaro.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=matt@codeblueprint.co.uk \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.