Skip to contentSkip to conversation

tpm-dev-common: Use sizeof instead of constant

PATCH New Alexander Steffen 1 participant 1 message Jul 4, 2017 TPM device driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tpm-dev-common: Use sizeof instead of constant

This avoids accidentially changing the structure definition, without adopting this size check.

---
 drivers/char/tpm/tpm-dev-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/tpm/tpm-dev-common.c +1 -1
index 610638a..192740e 100644
@@ -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);
Signature · 6 lines
2.7.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot