mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
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 <richard@nod.at>
Subject: [PATCH 1/2] x86,efi: Check max_size only if it is non-zero.
Date: Wed, 10 Apr 2013 10:59:34 +0200	[thread overview]
Message-ID: <1365584375-9372-1-git-send-email-richard@nod.at> (raw)

Some EFI implementations return always a MaximumVariableSize of 0,
check against max_size only if it is non-zero.
My Intel DQ67SW desktop board has such an implementation.

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 arch/x86/platform/efi/efi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index c89c245..3f96a48 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -1018,7 +1018,12 @@ efi_status_t efi_query_variable_store(u32 attributes, unsigned long size)
 	if (status != EFI_SUCCESS)
 		return status;
 
-	if (!storage_size || size > remaining_size || size > max_size ||
+	if (!max_size && remaining_size > size)
+		printk_once(KERN_ERR FW_BUG "Broken EFI implementation"
+			    " is returning MaxVariableSize=0\n");
+
+	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


             reply	other threads:[~2013-04-10  8:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-10  8:59 Richard Weinberger [this message]
2013-04-10  8:59 ` [PATCH 2/2] x86,efi: Implement no_storage_paranoia parameter Richard Weinberger
2013-04-11 15:19   ` Matt Fleming
2013-04-11 15:13 ` [PATCH 1/2] x86,efi: Check max_size only if it is non-zero Matt Fleming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1365584375-9372-1-git-send-email-richard@nod.at \
    --to=richard@nod.at \
    --cc=cbouatmailru@gmail.com \
    --cc=ccross@android.com \
    --cc=keescook@chromium.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.fleming@intel.com \
    --cc=matthew.garrett@nebula.com \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®