]> git.proxmox.com Git - mirror_edk2.git/commitdiff
NetworkPkg/IScsiDxe: simplify "ISCSI_CHAP_AUTH_DATA.InChallenge" size
authorLaszlo Ersek <lersek@redhat.com>
Tue, 8 Jun 2021 12:12:51 +0000 (14:12 +0200)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 9 Jun 2021 17:25:03 +0000 (17:25 +0000)
The ISCSI_CHAP_AUTH_MAX_LEN macro is defined with value 1024.

The usage of this macro currently involves a semantic (not functional)
bug, which we're going to fix in a subsequent patch, eliminating
ISCSI_CHAP_AUTH_MAX_LEN altogether.

For now, remove the macro's usage from all
"ISCSI_CHAP_AUTH_DATA.InChallenge" contexts. This is doable without
duplicating open-coded constants.

No changes in functionality.

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3356
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Message-Id: <20210608121259.32451-3-lersek@redhat.com>

NetworkPkg/IScsiDxe/IScsiCHAP.c
NetworkPkg/IScsiDxe/IScsiCHAP.h

index cbbc56ae5b4377e1f0ad3063ef1341b6baf5b3a6..df3c2eb1200a73626e50f24cabf2cdbdbdfb1570 100644 (file)
@@ -289,7 +289,7 @@ IScsiCHAPOnRspReceived (
     }\r
 \r
     AuthData->InIdentifier      = (UINT32) Result;\r
-    AuthData->InChallengeLength = ISCSI_CHAP_AUTH_MAX_LEN;\r
+    AuthData->InChallengeLength = (UINT32) sizeof (AuthData->InChallenge);\r
     IScsiHexToBin (\r
       (UINT8 *) AuthData->InChallenge,\r
       &AuthData->InChallengeLength,\r
index 5e59fb678bd7efcb5cf02ceb78a066fc1f00f56c..1fc1d96ea3f30f2e415c91543a0a77be11b21d0c 100644 (file)
@@ -49,7 +49,7 @@ typedef struct _ISCSI_CHAP_AUTH_CONFIG_NVDATA {
 typedef struct _ISCSI_CHAP_AUTH_DATA {\r
   ISCSI_CHAP_AUTH_CONFIG_NVDATA *AuthConfig;\r
   UINT32                        InIdentifier;\r
-  UINT8                         InChallenge[ISCSI_CHAP_AUTH_MAX_LEN];\r
+  UINT8                         InChallenge[1024];\r
   UINT32                        InChallengeLength;\r
   //\r
   // Calculated CHAP Response (CHAP_R) value.\r