drivers/crypto/sa2ul.c:1674:6: warning: variable 'auth_len' set but not used

From: kernel test robot
Date: Wed Jun 02 2021 - 15:54:04 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 231bc539066760aaa44d46818c85b14ca2f56d9f
commit: 00c9211f60db2dead16856f81a3e6ab86b31f275 crypto: sa2ul - Fix DMA mapping API usage
date: 8 months ago
config: arm64-randconfig-r005-20210601 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project d41cb6bb2607fa5c7a9df2b3dab361353657d225)
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
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=00c9211f60db2dead16856f81a3e6ab86b31f275
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 00c9211f60db2dead16856f81a3e6ab86b31f275
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/crypto/sa2ul.c:1674:6: warning: variable 'auth_len' set but not used [-Wunused-but-set-variable]
u16 auth_len;
^
1 warning generated.


vim +/auth_len +1674 drivers/crypto/sa2ul.c

2dc53d0047458e2 Keerthy 2020-07-13 1662
d2c8ac187fc922e Keerthy 2020-07-13 1663 static void sa_aead_dma_in_callback(void *data)
d2c8ac187fc922e Keerthy 2020-07-13 1664 {
d2c8ac187fc922e Keerthy 2020-07-13 1665 struct sa_rx_data *rxd = (struct sa_rx_data *)data;
d2c8ac187fc922e Keerthy 2020-07-13 1666 struct aead_request *req;
d2c8ac187fc922e Keerthy 2020-07-13 1667 struct crypto_aead *tfm;
d2c8ac187fc922e Keerthy 2020-07-13 1668 unsigned int start;
d2c8ac187fc922e Keerthy 2020-07-13 1669 unsigned int authsize;
d2c8ac187fc922e Keerthy 2020-07-13 1670 u8 auth_tag[SA_MAX_AUTH_TAG_SZ];
d2c8ac187fc922e Keerthy 2020-07-13 1671 size_t pl, ml;
00c9211f60db2de Peter Ujfalusi 2020-09-23 1672 int i;
d2c8ac187fc922e Keerthy 2020-07-13 1673 int err = 0;
d2c8ac187fc922e Keerthy 2020-07-13 @1674 u16 auth_len;
d2c8ac187fc922e Keerthy 2020-07-13 1675 u32 *mdptr;
d2c8ac187fc922e Keerthy 2020-07-13 1676
00c9211f60db2de Peter Ujfalusi 2020-09-23 1677 sa_sync_from_device(rxd);
d2c8ac187fc922e Keerthy 2020-07-13 1678 req = container_of(rxd->req, struct aead_request, base);
d2c8ac187fc922e Keerthy 2020-07-13 1679 tfm = crypto_aead_reqtfm(req);
d2c8ac187fc922e Keerthy 2020-07-13 1680 start = req->assoclen + req->cryptlen;
d2c8ac187fc922e Keerthy 2020-07-13 1681 authsize = crypto_aead_authsize(tfm);
d2c8ac187fc922e Keerthy 2020-07-13 1682
d2c8ac187fc922e Keerthy 2020-07-13 1683 mdptr = (u32 *)dmaengine_desc_get_metadata_ptr(rxd->tx_in, &pl, &ml);
d2c8ac187fc922e Keerthy 2020-07-13 1684 for (i = 0; i < (authsize / 4); i++)
d2c8ac187fc922e Keerthy 2020-07-13 1685 mdptr[i + 4] = swab32(mdptr[i + 4]);
d2c8ac187fc922e Keerthy 2020-07-13 1686
d2c8ac187fc922e Keerthy 2020-07-13 1687 auth_len = req->assoclen + req->cryptlen;
d2c8ac187fc922e Keerthy 2020-07-13 1688
d2c8ac187fc922e Keerthy 2020-07-13 1689 if (rxd->enc) {
d2c8ac187fc922e Keerthy 2020-07-13 1690 scatterwalk_map_and_copy(&mdptr[4], req->dst, start, authsize,
d2c8ac187fc922e Keerthy 2020-07-13 1691 1);
d2c8ac187fc922e Keerthy 2020-07-13 1692 } else {
00c9211f60db2de Peter Ujfalusi 2020-09-23 1693 auth_len -= authsize;
d2c8ac187fc922e Keerthy 2020-07-13 1694 start -= authsize;
d2c8ac187fc922e Keerthy 2020-07-13 1695 scatterwalk_map_and_copy(auth_tag, req->src, start, authsize,
d2c8ac187fc922e Keerthy 2020-07-13 1696 0);
d2c8ac187fc922e Keerthy 2020-07-13 1697
d2c8ac187fc922e Keerthy 2020-07-13 1698 err = memcmp(&mdptr[4], auth_tag, authsize) ? -EBADMSG : 0;
d2c8ac187fc922e Keerthy 2020-07-13 1699 }
d2c8ac187fc922e Keerthy 2020-07-13 1700
00c9211f60db2de Peter Ujfalusi 2020-09-23 1701 sa_free_sa_rx_data(rxd);
d2c8ac187fc922e Keerthy 2020-07-13 1702
d2c8ac187fc922e Keerthy 2020-07-13 1703 aead_request_complete(req, err);
d2c8ac187fc922e Keerthy 2020-07-13 1704 }
d2c8ac187fc922e Keerthy 2020-07-13 1705

:::::: The code at line 1674 was first introduced by commit
:::::: d2c8ac187fc922e73930a1b2f6a211e27f595d01 crypto: sa2ul - Add AEAD algorithm support

:::::: TO: Keerthy <j-keerthy@xxxxxx>
:::::: CC: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip