From: Ross Lagerwall Subject: [PATCH] EFI: Fix getting EFI variable list on some systems Date: Mon, 9 Mar 2015 16:47:59 +0000 Message-ID: <1425919679-22436-1-git-send-email-ross.lagerwall@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Ross Lagerwall , Jan Beulich List-Id: xen-devel@lists.xenproject.org Copy the entire output buffer to the guest because it may contain data beyond the output size that the firmware requires on a subsequent GetNextVariableName() call (e.g. a NULL character). The spec requires that on each call, "the previous results" be passed in. Without this change, the following (simplified) sequence would occur: GetNextVariableName: in \0, out AdminPw\0, size 7 GetNextVariableName: in AdminPw\0, out UserPw\0, size 6 GetNextVariableName: in UserPww\0, NOT FOUND Signed-off-by: Ross Lagerwall --- xen/common/efi/runtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c index 7ed5bfa..20772f3 100644 --- a/xen/common/efi/runtime.c +++ b/xen/common/efi/runtime.c @@ -518,7 +518,7 @@ int efi_runtime_call(struct xenpf_efi_runtime_call *op) if ( !EFI_ERROR(status) && copy_to_guest(op->u.get_next_variable_name.name, - name.raw, size) ) + name.raw, op->u.get_next_variable_name.size) ) rc = -EFAULT; op->u.get_next_variable_name.size = size; } -- 2.1.0