Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: lrw - Only add ecb if it is not already there

Only add ecb to the cipher name if it isn't already ecb.

Also use memcmp instead of strncmp since these strings are all
stored in an array of length CRYPTO_MAX_ALG_NAME.

Fixes: 700cb3f5fe75 ("crypto: lrw - Convert to skcipher")
Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202505151503.d8a6cf10-lkp@intel.com
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Herbert Xu 3d73909b 18c438b2

+2 -2
+2 -2
crypto/lrw.c
··· 322 322 323 323 err = crypto_grab_skcipher(spawn, skcipher_crypto_instance(inst), 324 324 cipher_name, 0, mask); 325 - if (err == -ENOENT) { 325 + if (err == -ENOENT && memcmp(cipher_name, "ecb(", 4)) { 326 326 err = -ENAMETOOLONG; 327 327 if (snprintf(ecb_name, CRYPTO_MAX_ALG_NAME, "ecb(%s)", 328 328 cipher_name) >= CRYPTO_MAX_ALG_NAME) ··· 356 356 /* Alas we screwed up the naming so we have to mangle the 357 357 * cipher name. 358 358 */ 359 - if (!strncmp(cipher_name, "ecb(", 4)) { 359 + if (!memcmp(cipher_name, "ecb(", 4)) { 360 360 int len; 361 361 362 362 len = strscpy(ecb_name, cipher_name + 4, sizeof(ecb_name));