Skip to contentSkip to conversation

crct10dif: remove extra function call in crc_t10dif() and crc_t10dif_update()

PATCH In review Akinobu Mita 2 participants 2 messages May 6, 2015 – May 8, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crct10dif: remove extra function call in crc_t10dif() and crc_t10dif_update()

Calling crypto_shash_import() in crc_t10dif() and crc_t10dif_update() is overkill as the existing crct10dif modules (crct10dif-generic and crct10dif-pclmul) don't require.

We also do the same thing with crc32c() in lib/libcrc32.c.

Cc Tim Chen <[email protected]>
Cc Herbert Xu <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Nicholas Bellinger <[email protected]>
Cc Sagi Grimberg <[email protected]>
Cc "Martin K. Petersen" <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>
---
 lib/crc-t10dif.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
lib/crc-t10dif.c +1 -2
index d775737..1ad33e5 100644
@@ -32,9 +32,8 @@ __u16 crc_t10dif_update(__u16 crc, const unsigned char *buffer, size_t len)
 
 	desc.shash.tfm = crct10dif_tfm;
 	desc.shash.flags = 0;
+	*(__u16 *)desc.ctx = crc;
 
-	err = crypto_shash_import(&desc.shash, &crc);
-	BUG_ON(err);
 	err = crypto_shash_update(&desc.shash, buffer, len);
 	BUG_ON(err);
 
Signature · 1 line
1.9.1
#1 lore raw
Quoted 27 lines · Akinobu Mita

Calling crypto_shash_import() in crc_t10dif() and crc_t10dif_update() is overkill as the existing crct10dif modules (crct10dif-generic and crct10dif-pclmul) don't require.

We also do the same thing with crc32c() in lib/libcrc32.c.

Cc Tim Chen <[email protected]>
Cc Herbert Xu <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Nicholas Bellinger <[email protected]>
Cc Sagi Grimberg <[email protected]>
Cc "Martin K. Petersen" <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>
---
 lib/crc-t10dif.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
lib/crc-t10dif.c +0 -0
index d775737..1ad33e5 100644

lib/crc-t10dif.c __u16 crc_t10dif_update(__u16 crc, const unsigned char *buffer, size_t len) · line 39

Quoted 10 lines
lib/crc-t10dif.c +1 -2
@@ -32,9 +32,8 @@ __u16 crc_t10dif_update(__u16 crc, const unsigned char *buffer, size_t len)
 
 	desc.shash.tfm = crct10dif_tfm;
 	desc.shash.flags = 0;
+	*(__u16 *)desc.ctx = crc;
 
-	err = crypto_shash_import(&desc.shash, &crc);
-	BUG_ON(err);
 	err = crypto_shash_update(&desc.shash, buffer, len);
 	BUG_ON(err);
 

Applied + squashed into the original commit in target-pending/for-next:

lib: introduce crc_t10dif_update()

Please let me know if anything else needs to be applied.

Thanks Akinobu + Tim + Herbert!

--nab