tpmdd-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] tpm/tpm_crb: fix priv->cmd_size initialisation
       [not found] ` <20170619062717.39849-1-manuel.lauss-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-06-22 11:52   ` Jarkko Sakkinen
  0 siblings, 0 replies; only message in thread
From: Jarkko Sakkinen @ 2017-06-22 11:52 UTC (permalink / raw)
  To: Manuel Lauss; +Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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.lauss-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Thanks.

Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

/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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-06-22 11:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20170619062717.39849-1-manuel.lauss@gmail.com>
     [not found] ` <20170619062717.39849-1-manuel.lauss-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-06-22 11:52   ` [PATCH] tpm/tpm_crb: fix priv->cmd_size initialisation Jarkko Sakkinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).