From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=217.140.101.70; helo=foss.arm.com; envelope-from=vijayenthiran.subramaniam@arm.com; receiver=edk2-devel@lists.01.org Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by ml01.01.org (Postfix) with ESMTP id B124821190710 for ; Tue, 20 Nov 2018 02:38:16 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4C1FB80D; Tue, 20 Nov 2018 02:38:16 -0800 (PST) Received: from usa.arm.com (a074939-lin.blr.arm.com [10.162.0.38]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 814573F575; Tue, 20 Nov 2018 02:38:14 -0800 (PST) From: Vijayenthiran Subramaniam To: edk2-devel@lists.01.org, star.zeng@intel.com, jian.j.wang@intel.com, ruiyu.ni@intel.com Cc: Vijayenthiran Subramaniam Date: Tue, 20 Nov 2018 16:08:05 +0530 Message-Id: <20181120103805.18637-1-vijayenthiran.subramaniam@arm.com> X-Mailer: git-send-email 2.17.1 Subject: [PATCH] MdeModulePkg/Variable: add debug logs in VariableServiceSetVariable X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Nov 2018 10:38:16 -0000 X-List-Received-Date: Tue, 20 Nov 2018 10:38:16 -0000 X-List-Received-Date: Tue, 20 Nov 2018 10:38:16 -0000 X-List-Received-Date: Tue, 20 Nov 2018 10:38:16 -0000 X-List-Received-Date: Tue, 20 Nov 2018 10:38:16 -0000 X-List-Received-Date: Tue, 20 Nov 2018 10:38:16 -0000 X-List-Received-Date: Tue, 20 Nov 2018 10:38:16 -0000 X-List-Received-Date: Tue, 20 Nov 2018 10:38:16 -0000 X-List-Received-Date: Tue, 20 Nov 2018 10:38:16 -0000 X-List-Received-Date: Tue, 20 Nov 2018 10:38:16 -0000 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 Cc: Jian J Wang Cc: Ruiyu Ni Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Vijayenthiran Subramaniam --- 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