|
@@ -198,8 +198,7 @@ static int crb_recv(struct tpm_chip *chip, u8 *buf, size_t count)
|
|
|
|
|
|
memcpy_fromio(buf, priv->rsp, 6);
|
|
memcpy_fromio(buf, priv->rsp, 6);
|
|
expected = be32_to_cpup((__be32 *) &buf[2]);
|
|
expected = be32_to_cpup((__be32 *) &buf[2]);
|
|
-
|
|
|
|
- if (expected > count)
|
|
|
|
|
|
+ if (expected > count || expected < 6)
|
|
return -EIO;
|
|
return -EIO;
|
|
|
|
|
|
memcpy_fromio(&buf[6], &priv->rsp[6], expected - 6);
|
|
memcpy_fromio(&buf[6], &priv->rsp[6], expected - 6);
|