tpm_crb: initialise priv->cmd_size sooner
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): 20170616194848.232936-1-manuel.lauss-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 6 lines · Manuel Lauss
priv->cmd_sizeis never initialised if the cmd and rsp buffers reside at different addresses. Move initialisation to right after the buffer was mapped.This bug was introduced by commit
aa77ea0e43dc5bb0c1dcc9bad76afa("tpm/tpm_crb: cachecmd_sizeregister value.").
Please, use a Fixes tag.
Quoted 10 lines
Signed-off-by Manuel Lauss <[email protected]>--- drivers/char/tpm/tpm_crb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/char/tpm/tpm_crb.c +0
-0
drivers/char/tpm/tpm_crb.c static int crb_map_io(struct acpi_device *device, struct crb_priv *priv, · line 499
Quoted 5 lines
drivers/char/tpm/tpm_crb.c +2
-0@@ -495,6 +495,8 @@ static int crb_map_io(struct acpi_device *device, struct crb_priv *priv, goto out; } + priv->cmd_size = cmd_size; +
Should be done only if rsp is succesfully mapped.
drivers/char/tpm/tpm_crb.c static int crb_map_io(struct acpi_device *device, struct crb_priv *priv, · line 522
Quoted 12 lines
drivers/char/tpm/tpm_crb.c +0
-2memcpy_fromio (&rsp_pa, &priv->regs_t->ctrl_rsp_pa,8 ); rsp_pa =le64_to_cpu (rsp_pa); rsp_size = crb_fixup_cmd_size(dev, &io_res, rsp_pa,@@ -515,8 +517,6 @@ 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:
/Jarkko
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot