On Mon, Jun 19, 2017 at 08:27:17AM +0200, Manuel Lauss wrote:
> 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.").
> Signed-off-by: Manuel Lauss <manuel.la...@gmail.com>

Thanks.

Reviewed-by: Jarkko Sakkinen <jarkko.sakki...@linux.intel.com>

/Jarkko

> ---
>  drivers/char/tpm/tpm_crb.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
> index b917b9d5f710..c3989b090c5b 100644
> --- a/drivers/char/tpm/tpm_crb.c
> +++ b/drivers/char/tpm/tpm_crb.c
> @@ -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;
> -- 
> 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
_______________________________________________
tpmdd-devel mailing list
tpmdd-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tpmdd-devel

Reply via email to