public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
To: edk2-devel@lists.01.org, star.zeng@intel.com,
	jian.j.wang@intel.com, ruiyu.ni@intel.com
Cc: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
Subject: [PATCH] MdeModulePkg/Variable: add debug logs in VariableServiceSetVariable
Date: Tue, 20 Nov 2018 16:08:05 +0530	[thread overview]
Message-ID: <20181120103805.18637-1-vijayenthiran.subramaniam@arm.com> (raw)

Print debug messages if size of the VariableName plus DataSize exceeds
Max(Auth|Voltaile)VariableSize bytes. The messages will be useful if any
platform specific value of Max(Auth|Voltaile)VariableSize PCDs have to
be changed.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
---
 MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
index 8e8db71bd201..db54fa4412c0 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
@@ -3234,14 +3234,20 @@ VariableServiceSetVariable (
     //
     if ((Attributes & VARIABLE_ATTRIBUTE_AT_AW) != 0) {
       if (StrSize (VariableName) + PayloadSize > mVariableModuleGlobal->MaxAuthVariableSize - GetVariableHeaderSize ()) {
+        DEBUG ((DEBUG_ERROR, "%a: Size of (%s) variable + DataSize exceeds MaxAuthVariableSize.\n",
+          __FUNCTION__, VariableName));
         return EFI_INVALID_PARAMETER;
       }
     } else if ((Attributes & EFI_VARIABLE_NON_VOLATILE) != 0) {
       if (StrSize (VariableName) + PayloadSize > mVariableModuleGlobal->MaxVariableSize - GetVariableHeaderSize ()) {
+        DEBUG ((DEBUG_ERROR, "%a: Size of (%s) variable + DataSize exceeds MaxVariableSize.\n",
+          __FUNCTION__, VariableName));
         return EFI_INVALID_PARAMETER;
       }
     } else {
       if (StrSize (VariableName) + PayloadSize > mVariableModuleGlobal->MaxVolatileVariableSize - GetVariableHeaderSize ()) {
+        DEBUG ((DEBUG_ERROR, "%a: Size of (%s) variable + DataSize exceeds MaxVolatileVariableSize.\n",
+          __FUNCTION__, VariableName));
         return EFI_INVALID_PARAMETER;
       }
     }
-- 
2.17.1



             reply	other threads:[~2018-11-20 10:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-20 10:38 Vijayenthiran Subramaniam [this message]
2018-11-20 11:17 ` [PATCH] MdeModulePkg/Variable: add debug logs in VariableServiceSetVariable Laszlo Ersek
2018-11-21  1:47   ` Zeng, Star

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-list 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=20181120103805.18637-1-vijayenthiran.subramaniam@arm.com \
    --to=devel@edk2.groups.io \
    /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