]> xenbits.xensource.com Git - seabios.git/commitdiff
tpm: Be consistent with array sizes in tcgbios.c
authorStefan Berger <stefanb@linux.vnet.ibm.com>
Tue, 9 Jun 2015 23:56:29 +0000 (19:56 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Thu, 11 Jun 2015 22:36:17 +0000 (18:36 -0400)
Remove the array size from all arrays.

Replace the magic 12 with sizeof(GetCapability_Timeouts),
which represents the maximum number of bytes that need to be
reserved.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
src/tcgbios.c

index 94d54d80cdbdd8b3e1c628ba14f76d9a951df5c2..58170d77693e3d579882fb5c81f1ca7684e0c78f 100644 (file)
 #include "fw/paravirt.h" // runningOnXen
 #include "std/smbios.h"
 
-static const u8 Startup_ST_CLEAR[2] = { 0x00, TPM_ST_CLEAR };
-static const u8 Startup_ST_STATE[2] = { 0x00, TPM_ST_STATE };
+static const u8 Startup_ST_CLEAR[] = { 0x00, TPM_ST_CLEAR };
+static const u8 Startup_ST_STATE[] = { 0x00, TPM_ST_STATE };
 
-static const u8 PhysicalPresence_CMD_ENABLE[2]  = { 0x00, 0x20 };
-static const u8 PhysicalPresence_CMD_DISABLE[2] = { 0x01, 0x00 };
-static const u8 PhysicalPresence_PRESENT[2]     = { 0x00, 0x08 };
-static const u8 PhysicalPresence_NOT_PRESENT_LOCK[2] = { 0x00, 0x14 };
+static const u8 PhysicalPresence_CMD_ENABLE[]  = { 0x00, 0x20 };
+static const u8 PhysicalPresence_CMD_DISABLE[] = { 0x01, 0x00 };
+static const u8 PhysicalPresence_PRESENT[]     = { 0x00, 0x08 };
+static const u8 PhysicalPresence_NOT_PRESENT_LOCK[] = { 0x00, 0x14 };
 
 static const u8 CommandFlag_FALSE[1] = { 0x00 };
 static const u8 CommandFlag_TRUE[1]  = { 0x01 };
 
-static const u8 GetCapability_Permanent_Flags[12] = {
+static const u8 GetCapability_Permanent_Flags[] = {
     0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04,
     0x00, 0x00, 0x01, 0x08
 };
 
-static const u8 GetCapability_OwnerAuth[12] = {
+static const u8 GetCapability_OwnerAuth[] = {
     0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04,
     0x00, 0x00, 0x01, 0x11
 };
@@ -301,7 +301,7 @@ build_and_send_cmd_od(u8 locty, u32 ordinal, const u8 *append, u32 append_size,
                       const u8 *otherdata, u32 otherdata_size,
                       enum tpmDurationType to_t)
 {
-#define MAX_APPEND_SIZE   12
+#define MAX_APPEND_SIZE   sizeof(GetCapability_Timeouts)
 #define MAX_RESPONSE_SIZE sizeof(struct tpm_res_getcap_perm_flags)
     u32 rc;
     u8 ibuffer[TPM_REQ_HEADER_SIZE + MAX_APPEND_SIZE];