From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932279AbcA2Pjj (ORCPT ); Fri, 29 Jan 2016 10:39:39 -0500 Received: from mail-wm0-f48.google.com ([74.125.82.48]:33033 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756350AbcA2Pji (ORCPT ); Fri, 29 Jan 2016 10:39:38 -0500 Date: Fri, 29 Jan 2016 15:39:35 +0000 From: Matt Fleming To: Ard Biesheuvel Cc: linux-arm-kernel@lists.infradead.org, kernel-hardening@lists.openwall.com, will.deacon@arm.com, catalin.marinas@arm.com, mark.rutland@arm.com, leif.lindholm@linaro.org, keescook@chromium.org, linux-kernel@vger.kernel.org, stuart.yoder@freescale.com, bhupesh.sharma@freescale.com, arnd@arndb.de, marc.zyngier@arm.com, christoffer.dall@linaro.org, labbott@fedoraproject.org Subject: Re: [PATCH v4 20/22] efi: stub: add implementation of efi_random_alloc() Message-ID: <20160129153935.GB2611@codeblueprint.co.uk> References: <1453828249-14467-1-git-send-email-ard.biesheuvel@linaro.org> <1453828249-14467-21-git-send-email-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1453828249-14467-21-git-send-email-ard.biesheuvel@linaro.org> User-Agent: Mutt/1.5.24+41 (02bc14ed1569) (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 26 Jan, at 06:10:47PM, Ard Biesheuvel wrote: > + > +/* > + * The UEFI memory descriptors have a virtual address field that is only used > + * when installing the virtual mapping using SetVirtualAddressMap(). Since it > + * is unused here, we can reuse it to keep track of each descriptor's slot > + * count. > + */ > +#define MD_NUM_SLOTS(md) ((md)->virt_addr) > + > +efi_status_t efi_random_alloc(efi_system_table_t *sys_table_arg, > + unsigned long size, > + unsigned long align, > + unsigned long *addr, > + unsigned long random_seed) > +{ > + unsigned long map_size, desc_size, total_slots = 0, target_slot; > + efi_status_t status = EFI_NOT_FOUND; > + efi_memory_desc_t *memory_map; > + int map_offset; The assignment of 'status' is not needed since it gets assigned a new value immediately. Otherwise looks good. Reviewed-by: Matt Fleming From mboxrd@z Thu Jan 1 00:00:00 1970 From: matt@codeblueprint.co.uk (Matt Fleming) Date: Fri, 29 Jan 2016 15:39:35 +0000 Subject: [PATCH v4 20/22] efi: stub: add implementation of efi_random_alloc() In-Reply-To: <1453828249-14467-21-git-send-email-ard.biesheuvel@linaro.org> References: <1453828249-14467-1-git-send-email-ard.biesheuvel@linaro.org> <1453828249-14467-21-git-send-email-ard.biesheuvel@linaro.org> Message-ID: <20160129153935.GB2611@codeblueprint.co.uk> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Tue, 26 Jan, at 06:10:47PM, Ard Biesheuvel wrote: > + > +/* > + * The UEFI memory descriptors have a virtual address field that is only used > + * when installing the virtual mapping using SetVirtualAddressMap(). Since it > + * is unused here, we can reuse it to keep track of each descriptor's slot > + * count. > + */ > +#define MD_NUM_SLOTS(md) ((md)->virt_addr) > + > +efi_status_t efi_random_alloc(efi_system_table_t *sys_table_arg, > + unsigned long size, > + unsigned long align, > + unsigned long *addr, > + unsigned long random_seed) > +{ > + unsigned long map_size, desc_size, total_slots = 0, target_slot; > + efi_status_t status = EFI_NOT_FOUND; > + efi_memory_desc_t *memory_map; > + int map_offset; The assignment of 'status' is not needed since it gets assigned a new value immediately. Otherwise looks good. Reviewed-by: Matt Fleming From mboxrd@z Thu Jan 1 00:00:00 1970 Reply-To: kernel-hardening@lists.openwall.com Date: Fri, 29 Jan 2016 15:39:35 +0000 From: Matt Fleming Message-ID: <20160129153935.GB2611@codeblueprint.co.uk> References: <1453828249-14467-1-git-send-email-ard.biesheuvel@linaro.org> <1453828249-14467-21-git-send-email-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1453828249-14467-21-git-send-email-ard.biesheuvel@linaro.org> Subject: [kernel-hardening] Re: [PATCH v4 20/22] efi: stub: add implementation of efi_random_alloc() To: Ard Biesheuvel Cc: linux-arm-kernel@lists.infradead.org, kernel-hardening@lists.openwall.com, will.deacon@arm.com, catalin.marinas@arm.com, mark.rutland@arm.com, leif.lindholm@linaro.org, keescook@chromium.org, linux-kernel@vger.kernel.org, stuart.yoder@freescale.com, bhupesh.sharma@freescale.com, arnd@arndb.de, marc.zyngier@arm.com, christoffer.dall@linaro.org, labbott@fedoraproject.org List-ID: On Tue, 26 Jan, at 06:10:47PM, Ard Biesheuvel wrote: > + > +/* > + * The UEFI memory descriptors have a virtual address field that is only used > + * when installing the virtual mapping using SetVirtualAddressMap(). Since it > + * is unused here, we can reuse it to keep track of each descriptor's slot > + * count. > + */ > +#define MD_NUM_SLOTS(md) ((md)->virt_addr) > + > +efi_status_t efi_random_alloc(efi_system_table_t *sys_table_arg, > + unsigned long size, > + unsigned long align, > + unsigned long *addr, > + unsigned long random_seed) > +{ > + unsigned long map_size, desc_size, total_slots = 0, target_slot; > + efi_status_t status = EFI_NOT_FOUND; > + efi_memory_desc_t *memory_map; > + int map_offset; The assignment of 'status' is not needed since it gets assigned a new value immediately. Otherwise looks good. Reviewed-by: Matt Fleming