diff mbox

[tpmdd-devel] tpm-dev-common: Use sizeof instead of constant

Message ID 20170704135521.9696-1-Alexander.Steffen@infineon.com
State New
Headers show

Commit Message

Alexander Steffen July 4, 2017, 1:55 p.m. UTC
This avoids accidentially changing the structure definition, without
adopting this size check.

Signed-off-by: Alexander Steffen <Alexander.Steffen@infineon.com>
---
 drivers/char/tpm/tpm-dev-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/char/tpm/tpm-dev-common.c b/drivers/char/tpm/tpm-dev-common.c
index 610638a..192740e 100644
--- a/drivers/char/tpm/tpm-dev-common.c
+++ b/drivers/char/tpm/tpm-dev-common.c
@@ -99,7 +99,7 @@  ssize_t tpm_common_write(struct file *file, const char __user *buf,
 	if (atomic_read(&priv->data_pending) != 0)
 		return -EBUSY;
 
-	if (in_size > TPM_BUFSIZE)
+	if (in_size > sizeof(priv->data_buffer))
 		return -E2BIG;
 
 	mutex_lock(&priv->buffer_mutex);