linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Fix ccp_run_passthru_cmd dma variable assignments
@ 2014-01-24 18:39 Dave Jones
  2014-01-24 20:17 ` Tom Lendacky
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Jones @ 2014-01-24 18:39 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: thomas.lendacky

There are some suspicious looking lines of code in the new ccp driver, including
one that assigns a variable to itself, and another that overwrites a previous assignment.

This may have been a cut-and-paste error where 'src' was forgotten to be changed to 'dst'.
I have no hardware to test this, so this is untested.

Signed-off-by: Dave Jones <davej@fedoraproject.org>

diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c
index 71ed3ade7e12..c266a7b154bb 100644
--- a/drivers/crypto/ccp/ccp-ops.c
+++ b/drivers/crypto/ccp/ccp-ops.c
@@ -1666,8 +1666,8 @@ static int ccp_run_passthru_cmd(struct ccp_cmd_queue *cmd_q,
 
 		op.dst.type = CCP_MEMTYPE_SYSTEM;
 		op.dst.u.dma.address = sg_dma_address(dst.sg_wa.sg);
-		op.src.u.dma.offset = dst.sg_wa.sg_used;
-		op.src.u.dma.length = op.src.u.dma.length;
+		op.dst.u.dma.offset = dst.sg_wa.sg_used;
+		op.dst.u.dma.length = op.src.u.dma.length;
 
 		ret = ccp_perform_passthru(&op);
 		if (ret) {

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: Fix ccp_run_passthru_cmd dma variable assignments
  2014-01-24 18:39 Fix ccp_run_passthru_cmd dma variable assignments Dave Jones
@ 2014-01-24 20:17 ` Tom Lendacky
  2014-02-09  9:20   ` Herbert Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Lendacky @ 2014-01-24 20:17 UTC (permalink / raw)
  To: Dave Jones, Linux Kernel Mailing List, herbert, linux-crypto

On 01/24/2014 12:39 PM, Dave Jones wrote:
> There are some suspicious looking lines of code in the new ccp driver, including
> one that assigns a variable to itself, and another that overwrites a previous assignment.
> 
> This may have been a cut-and-paste error where 'src' was forgotten to be changed to 'dst'.
> I have no hardware to test this, so this is untested.

Yes, this was a cut-and-paste error that was not discovered with my tests. I've
updated my testcases and tested/verified this fix.

Herbert, this should probably go through the cryptodev-2.6 tree right?

Acked-by: Tom Lendacky <thomas.lendacky@amd.com>

Thanks,
Tom

> 
> Signed-off-by: Dave Jones <davej@fedoraproject.org>
> 
> diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c
> index 71ed3ade7e12..c266a7b154bb 100644
> --- a/drivers/crypto/ccp/ccp-ops.c
> +++ b/drivers/crypto/ccp/ccp-ops.c
> @@ -1666,8 +1666,8 @@ static int ccp_run_passthru_cmd(struct ccp_cmd_queue *cmd_q,
>   
>   		op.dst.type = CCP_MEMTYPE_SYSTEM;
>   		op.dst.u.dma.address = sg_dma_address(dst.sg_wa.sg);
> -		op.src.u.dma.offset = dst.sg_wa.sg_used;
> -		op.src.u.dma.length = op.src.u.dma.length;
> +		op.dst.u.dma.offset = dst.sg_wa.sg_used;
> +		op.dst.u.dma.length = op.src.u.dma.length;
>   
>   		ret = ccp_perform_passthru(&op);
>   		if (ret) {
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Fix ccp_run_passthru_cmd dma variable assignments
  2014-01-24 20:17 ` Tom Lendacky
@ 2014-02-09  9:20   ` Herbert Xu
  0 siblings, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2014-02-09  9:20 UTC (permalink / raw)
  To: Tom Lendacky; +Cc: Dave Jones, Linux Kernel Mailing List, linux-crypto

On Fri, Jan 24, 2014 at 02:17:12PM -0600, Tom Lendacky wrote:
> On 01/24/2014 12:39 PM, Dave Jones wrote:
> > There are some suspicious looking lines of code in the new ccp driver, including
> > one that assigns a variable to itself, and another that overwrites a previous assignment.
> > 
> > This may have been a cut-and-paste error where 'src' was forgotten to be changed to 'dst'.
> > I have no hardware to test this, so this is untested.
> 
> Yes, this was a cut-and-paste error that was not discovered with my tests. I've
> updated my testcases and tested/verified this fix.
> 
> Herbert, this should probably go through the cryptodev-2.6 tree right?
> 
> Acked-by: Tom Lendacky <thomas.lendacky@amd.com>

Applied to cryptodev.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-09  9:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-24 18:39 Fix ccp_run_passthru_cmd dma variable assignments Dave Jones
2014-01-24 20:17 ` Tom Lendacky
2014-02-09  9:20   ` Herbert Xu

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).