]> Git Repo - J-u-boot.git/blobdiff - drivers/tpm/tpm_tis_infineon.c
Merge branch 'next' of git://git.denx.de/u-boot-video
[J-u-boot.git] / drivers / tpm / tpm_tis_infineon.c
index ef3ff0dbf67eb6705bf51e444661f8963a7ca4a7..41b748e7a23e09fef253ae8179c56feaeb99dc09 100644 (file)
@@ -374,7 +374,8 @@ static int tpm_tis_i2c_recv(struct udevice *dev, u8 *buf, size_t count)
 {
        struct tpm_chip *chip = dev_get_priv(dev);
        int size = 0;
-       int expected, status;
+       int status;
+       unsigned int expected;
        int rc;
 
        status = tpm_tis_i2c_status(dev);
@@ -394,7 +395,7 @@ static int tpm_tis_i2c_recv(struct udevice *dev, u8 *buf, size_t count)
        }
 
        expected = get_unaligned_be32(buf + TPM_RSP_SIZE_BYTE);
-       if ((size_t)expected > count) {
+       if ((size_t)expected > count || (size_t)expected < TPM_HEADER_SIZE) {
                debug("Error size=%x, expected=%x, count=%x\n", size, expected,
                      count);
                return -ENOSPC;
@@ -539,7 +540,7 @@ static int tpm_tis_i2c_init(struct udevice *dev)
        }
 
        if (chip->chip_type != UNKNOWN && vendor != expected_did_vid) {
-               error("Vendor id did not match! ID was %08x\n", vendor);
+               pr_err("Vendor id did not match! ID was %08x\n", vendor);
                return -ENODEV;
        }
 
This page took 0.024678 seconds and 4 git commands to generate.