Skip to contentSkip to conversation

Fix ccp_run_passthru_cmd dma variable assignments

PATCH Applied Dave Jones 3 participants 3 messages Jan 24, 2014 – Feb 9, 2014

Subsystems (2)
lore
Share & tools
lore

Dave Jones

author
#0 lore raw

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.

drivers/crypto/ccp/ccp-ops.c +2 -2
index 71ed3ade7e12..c266a7b154bb 100644
@@ -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) {
maintainer Acked-by
#1 lore raw
Quoted 5 lines · Dave Jones

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?

Thanks,
Tom

Quoted 19 lines
drivers/crypto/ccp/ccp-ops.c +2 -2
index 71ed3ade7e12..c266a7b154bb 100644
@@ -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) {
maintainer Applied
#2 lore raw
Quoted 7 lines · Tom Lendacky
Quoted 5 lines · Dave Jones

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.

Quoted 6 lines

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?

Applied to cryptodev. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt