Skip to contentSkip to conversation

tpm/tpm_crb: fix priv->cmd_size initialisation

PATCH Jarkko Sakkinen 1 participant 1 message Jun 22, 2017 2 messages not in the archive

lore
Share & tools
lore

Jarkko Sakkinen

author Reviewed-by
#2 lore raw
In reply to a message not in the archive
Quoted 6 lines · Manuel Lauss

priv->cmd_size is never initialised if the cmd and rsp buffers reside at different addresses. Initialise it in the exit path of the function when rsp buffer has also been successfully allocated.

Fixes aa77ea0e43dc ("tpm/tpm_crb: cache cmd_size register value.").

Thanks.

/Jarkko

Quoted 26 lines
---
 drivers/char/tpm/tpm_crb.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/char/tpm/tpm_crb.c +3 -2
index b917b9d5f710..c3989b090c5b 100644
@@ -515,11 +515,12 @@ static int crb_map_io(struct acpi_device *device, struct crb_priv *priv,
 		goto out;
 	}
 
-	priv->cmd_size = cmd_size;
-
 	priv->rsp = priv->cmd;
 
 out:
+	if (!ret)
+		priv->cmd_size = cmd_size;
+
 	crb_go_idle(dev, priv);
 
 	return ret;
Signature · 1 line
2.13.1

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