From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1aaxkh-00048B-Ut for mharc-grub-devel@gnu.org; Tue, 01 Mar 2016 22:47:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47255) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaxkf-00046C-NL for grub-devel@gnu.org; Tue, 01 Mar 2016 22:47:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aaxkW-0005VB-NL for grub-devel@gnu.org; Tue, 01 Mar 2016 22:47:05 -0500 Received: from mail-lb0-x229.google.com ([2a00:1450:4010:c04::229]:33098) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaxkW-0005TK-E0 for grub-devel@gnu.org; Tue, 01 Mar 2016 22:46:56 -0500 Received: by mail-lb0-x229.google.com with SMTP id k15so16543lbg.0 for ; Tue, 01 Mar 2016 19:46:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=JQJgEY+3K72EhFI31ZoWgbrEWqdu6ESdhrR68UHv4eo=; b=u9CjW5AmQwcBBe9Gl7R68Nks+bRRd2HPc40VQNOfupbW0RPdQs070vUylAch7CPMv4 ZOFKeYhZKP696VrP7isb+yyGVroiWXE+ao7tP/jzIyDP9aZ+lpo4vuZN8u+36FAgRZbh dv+uxP9F4tAra9UlOayXYk1pM8Bg74/W88MRHbGgNWMacAO6Inqrw8m4sb4e5iHjyIe9 eHb78vGHJ/W6TmkLlbBczAaj6pbVsxQyeHxEIS3cR00+7Gw673qzQWWxeXbuCrFolRpj F6h077tL4eEeJErdhYIxOlkQXRYOwfP0RAdqyNX1K6e0wfS/mWBV/s2x0Scv9rsPScRW cKfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=JQJgEY+3K72EhFI31ZoWgbrEWqdu6ESdhrR68UHv4eo=; b=IWcX3n2P4G8JzHcPKXkV8/DCNsanPXG2ruXIXr0AXNTBeIh6wdtpbNu9ezNzmYCwRt jx9r9v/PvMrEuNeCLhC7YBFQPagTEdc0r2dW4S5yzG4lYyh7owVuhE2Y4vCmz6P1+ELJ XCefVBYAszJuoGJlbFK0LApRFzdg8snX/GBwZvoOejs9kF6au5fwWp8HvECHw2zPqRAI ne9E05shjp6y/ET/Nkd3out4Dy1NAwCIvbApSp32zBsqvThA4EO1m/gQwWXBwUzL/Oyo rUeNlVWd8SWiNxAnzK6yWn8cxgv91RNLDgMvtKmpGDuHJyMQm4vE7k3KwYiPwJQY7sqU CBMQ== X-Gm-Message-State: AD7BkJK36ht4O6GIXQcPPVgi8z+gBFr3EbZApp7K7kYoFrsT3O+3bkkBI/bXju1TswwAQw== X-Received: by 10.112.132.5 with SMTP id oq5mr9000950lbb.16.1456890413460; Tue, 01 Mar 2016 19:46:53 -0800 (PST) Received: from [192.168.1.41] (ppp109-252-76-159.pppoe.spdop.ru. [109.252.76.159]) by smtp.gmail.com with ESMTPSA id f134sm5416207lff.34.2016.03.01.19.46.52 for (version=TLSv1/SSLv3 cipher=OTHER); Tue, 01 Mar 2016 19:46:52 -0800 (PST) Subject: Re: [PATCH v2 2/3] efidisk: implement alignment-respecting malloc function To: grub-devel@gnu.org References: <1456877652-19389-1-git-send-email-leif.lindholm@linaro.org> <1456877652-19389-3-git-send-email-leif.lindholm@linaro.org> From: Andrei Borzenkov Message-ID: <56D6622C.9030909@gmail.com> Date: Wed, 2 Mar 2016 06:46:52 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1456877652-19389-3-git-send-email-leif.lindholm@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c04::229 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Mar 2016 03:47:06 -0000 02.03.2016 03:14, Leif Lindholm пишет: > Implement a driver-specific malloc function that allocates a buffer > with the alignment specified by grub_efi_block_io_media structure. > --- > grub-core/disk/efi/efidisk.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c > index 3b79f7b..ac99ea7 100644 > --- a/grub-core/disk/efi/efidisk.c > +++ b/grub-core/disk/efi/efidisk.c > @@ -457,6 +457,13 @@ get_device (struct grub_efidisk_data *devices, int num) > return 0; > } > > +static void * > +aligned_malloc (struct grub_disk *disk, grub_size_t size) > +{ > + struct grub_efidisk_data *d = disk->data; > + return grub_memalign (d->block_io->media->io_align, size); > +} > + > static grub_err_t > grub_efidisk_open (const char *name, struct grub_disk *disk) > { > @@ -512,6 +519,7 @@ grub_efidisk_open (const char *name, struct grub_disk *disk) > (1U << disk->log_sector_size) < m->block_size; > disk->log_sector_size++); > disk->data = d; > + disk->malloc = aligned_malloc; > > grub_dprintf ("efidisk", "opening %s succeeded\n", name); > > Did you drop sanity check in grub_efidisk_open intentionally?