Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934735AbcKWJef convert rfc822-to-8bit (ORCPT ); Wed, 23 Nov 2016 04:34:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59698 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756455AbcKWJe1 (ORCPT ); Wed, 23 Nov 2016 04:34:27 -0500 Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <147986056324.13790.12670822944798392730.stgit@warthog.procyon.org.uk> References: <147986056324.13790.12670822944798392730.stgit@warthog.procyon.org.uk> <147986054870.13790.8640536414645705863.stgit@warthog.procyon.org.uk> To: lukas@wunner.de Cc: dhowells@redhat.com, linux-efi@vger.kernel.org, linux-security-module@vger.kernel.org, keyrings@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/6] arm/efi: Allow invocation of arbitrary runtime services [ver #2] MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <5318.1479893643.1@warthog.procyon.org.uk> Content-Transfer-Encoding: 8BIT Date: Wed, 23 Nov 2016 09:34:03 +0000 Message-ID: <5320.1479893643@warthog.procyon.org.uk> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 23 Nov 2016 09:34:05 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 634 Lines: 17 David Howells wrote: > +#define efi_call_runtime(f, ...) sys_table_arg->runtime->f(__VA_ARGS__) Turns out it's not that simple - of course. runtime->get_variable is just a void pointer. The old arm stub was casting it by virtue of assignment to a function pointer variable. The x86_64 appears to be doing bypassing all the compile-time type checking by passing the arguments through an ellipsis and then fixing up the argument list in the ->call() function. What I've changed the ARM and ARM64 things to is: #define efi_call_runtime(f, ...) ((efi_##f##_t *)sys_table_arg->runtime->f)(__VA_ARGS__) David