[PATCH 10/22] crypto: atmel-aes - add check for xts input length equal to zero

kernel test robot lkp at intel.com
Sat Aug 8 04:06:21 AEST 2020


Hi Andrei,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on cryptodev/master]
[also build test WARNING on crypto/master next-20200807]
[cannot apply to powerpc/next sparc-next/master v5.8]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Andrei-Botila/crypto-add-check-for-xts-input-length-equal-to-zero/20200808-002648
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
config: arm-defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All warnings (new ones prefixed by >>):

   drivers/crypto/atmel-aes.c: In function 'atmel_aes_crypt':
>> drivers/crypto/atmel-aes.c:1111:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
    1111 |   if (!req->cryptlen)
         |      ^
   drivers/crypto/atmel-aes.c:1114:2: note: here
    1114 |  default:
         |  ^~~~~~~

vim +1111 drivers/crypto/atmel-aes.c

  1085	
  1086	static int atmel_aes_crypt(struct skcipher_request *req, unsigned long mode)
  1087	{
  1088		struct crypto_skcipher *skcipher = crypto_skcipher_reqtfm(req);
  1089		struct atmel_aes_base_ctx *ctx = crypto_skcipher_ctx(skcipher);
  1090		struct atmel_aes_reqctx *rctx;
  1091		struct atmel_aes_dev *dd;
  1092	
  1093		switch (mode & AES_FLAGS_OPMODE_MASK) {
  1094		case AES_FLAGS_CFB8:
  1095			ctx->block_size = CFB8_BLOCK_SIZE;
  1096			break;
  1097	
  1098		case AES_FLAGS_CFB16:
  1099			ctx->block_size = CFB16_BLOCK_SIZE;
  1100			break;
  1101	
  1102		case AES_FLAGS_CFB32:
  1103			ctx->block_size = CFB32_BLOCK_SIZE;
  1104			break;
  1105	
  1106		case AES_FLAGS_CFB64:
  1107			ctx->block_size = CFB64_BLOCK_SIZE;
  1108			break;
  1109	
  1110		case AES_FLAGS_XTS:
> 1111			if (!req->cryptlen)
  1112				return 0;
  1113	
  1114		default:
  1115			ctx->block_size = AES_BLOCK_SIZE;
  1116			break;
  1117		}
  1118		ctx->is_aead = false;
  1119	
  1120		dd = atmel_aes_find_dev(ctx);
  1121		if (!dd)
  1122			return -ENODEV;
  1123	
  1124		rctx = skcipher_request_ctx(req);
  1125		rctx->mode = mode;
  1126	
  1127		if ((mode & AES_FLAGS_OPMODE_MASK) != AES_FLAGS_ECB &&
  1128		    !(mode & AES_FLAGS_ENCRYPT) && req->src == req->dst) {
  1129			unsigned int ivsize = crypto_skcipher_ivsize(skcipher);
  1130	
  1131			if (req->cryptlen >= ivsize)
  1132				scatterwalk_map_and_copy(rctx->lastc, req->src,
  1133							 req->cryptlen - ivsize,
  1134							 ivsize, 0);
  1135		}
  1136	
  1137		return atmel_aes_handle_queue(dd, &req->base);
  1138	}
  1139	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 52679 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20200808/53474b31/attachment-0001.gz>


More information about the Linuxppc-dev mailing list