Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760742Ab3DDNBz (ORCPT ); Thu, 4 Apr 2013 09:01:55 -0400 Received: from a.ns.miles-group.at ([95.130.255.143]:47834 "EHLO radon.swed.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760589Ab3DDNBy (ORCPT ); Thu, 4 Apr 2013 09:01:54 -0400 From: Richard Weinberger To: matt.fleming@intel.com Cc: cbouatmailru@gmail.com, ccross@android.com, keescook@chromium.org, tony.luck@intel.com, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, matthew.garrett@nebula.com, Richard Weinberger Subject: [PATCH 1/2] efivars: Check max_size only if it is non-zero. Date: Thu, 4 Apr 2013 15:01:39 +0200 Message-Id: <1365080500-13677-1-git-send-email-richard@nod.at> X-Mailer: git-send-email 1.8.1.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1060 Lines: 30 Some (broken?) EFI implementations return always a MaximumVariableSize of 0, check against max_size only if it is non-zero. Signed-off-by: Richard Weinberger --- drivers/firmware/efivars.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index 7acafb8..8e87f8d 100644 --- a/drivers/firmware/efivars.c +++ b/drivers/firmware/efivars.c @@ -449,7 +449,8 @@ check_var_size_locked(struct efivars *efivars, u32 attributes, if (status != EFI_SUCCESS) return status; - if (!storage_size || size > remaining_size || size > max_size || + if (!storage_size || size > remaining_size || + (max_size && size > max_size) || (remaining_size - size) < (storage_size / 2)) return EFI_OUT_OF_RESOURCES; -- 1.8.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/