* [zen:6.3/zen-sauce 8/30] drivers/crypto/virtio/virtio_crypto_akcipher_algs.c:131:9: warning: 'memcpy' reading 56 bytes from a region of size 20
@ 2023-05-27 6:53 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-05-27 6:53 UTC (permalink / raw)
To: steven; +Cc: oe-kbuild-all
tree: https://github.com/zen-kernel/zen-kernel 6.3/zen-sauce
head: c25bf38649c4d20ae29994b1dadd4e87c3e67bf9
commit: ceddd33591c7112b797b7ca623d65679be0333c2 [8/30] ZEN: Disable stack conservation for GCC
config: powerpc-randconfig-r001-20230526 (https://download.01.org/0day-ci/archive/20230527/202305271402.RIbrAVed-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
mkdir -p ~/bin
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/zen-kernel/zen-kernel/commit/ceddd33591c7112b797b7ca623d65679be0333c2
git remote add zen https://github.com/zen-kernel/zen-kernel
git fetch --no-tags zen 6.3/zen-sauce
git checkout ceddd33591c7112b797b7ca623d65679be0333c2
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 ~/bin/make.cross W=1 O=build_dir ARCH=powerpc olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 ~/bin/make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash drivers/crypto/virtio/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202305271402.RIbrAVed-lkp@intel.com/
All warnings (new ones prefixed by >>):
In function 'virtio_crypto_alg_akcipher_init_session',
inlined from 'virtio_crypto_rsa_set_key' at drivers/crypto/virtio/virtio_crypto_akcipher_algs.c:425:9:
>> drivers/crypto/virtio/virtio_crypto_akcipher_algs.c:131:9: warning: 'memcpy' reading 56 bytes from a region of size 20 [-Wstringop-overread]
131 | memcpy(&ctrl->u, para, sizeof(ctrl->u));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/crypto/virtio/virtio_crypto_akcipher_algs.c: In function 'virtio_crypto_rsa_set_key':
drivers/crypto/virtio/virtio_crypto_akcipher_algs.c:375:52: note: source object 'para' of size 20
375 | struct virtio_crypto_akcipher_session_para para;
| ^~~~
vim +/memcpy +131 drivers/crypto/virtio/virtio_crypto_akcipher_algs.c
59ca6c93387d32 zhenwei pi 2022-03-02 105
59ca6c93387d32 zhenwei pi 2022-03-02 106 static int virtio_crypto_alg_akcipher_init_session(struct virtio_crypto_akcipher_ctx *ctx,
59ca6c93387d32 zhenwei pi 2022-03-02 107 struct virtio_crypto_ctrl_header *header, void *para,
59ca6c93387d32 zhenwei pi 2022-03-02 108 const uint8_t *key, unsigned int keylen)
59ca6c93387d32 zhenwei pi 2022-03-02 109 {
59ca6c93387d32 zhenwei pi 2022-03-02 110 struct scatterlist outhdr_sg, key_sg, inhdr_sg, *sgs[3];
59ca6c93387d32 zhenwei pi 2022-03-02 111 struct virtio_crypto *vcrypto = ctx->vcrypto;
59ca6c93387d32 zhenwei pi 2022-03-02 112 uint8_t *pkey;
59ca6c93387d32 zhenwei pi 2022-03-02 113 int err;
59ca6c93387d32 zhenwei pi 2022-03-02 114 unsigned int num_out = 0, num_in = 0;
6fd763d155860e zhenwei pi 2022-05-06 115 struct virtio_crypto_op_ctrl_req *ctrl;
6fd763d155860e zhenwei pi 2022-05-06 116 struct virtio_crypto_session_input *input;
0756ad15b1fef2 zhenwei pi 2022-05-06 117 struct virtio_crypto_ctrl_request *vc_ctrl_req;
59ca6c93387d32 zhenwei pi 2022-03-02 118
4409c08d806721 Christophe JAILLET 2023-02-04 119 pkey = kmemdup(key, keylen, GFP_KERNEL);
59ca6c93387d32 zhenwei pi 2022-03-02 120 if (!pkey)
59ca6c93387d32 zhenwei pi 2022-03-02 121 return -ENOMEM;
59ca6c93387d32 zhenwei pi 2022-03-02 122
0756ad15b1fef2 zhenwei pi 2022-05-06 123 vc_ctrl_req = kzalloc(sizeof(*vc_ctrl_req), GFP_KERNEL);
0756ad15b1fef2 zhenwei pi 2022-05-06 124 if (!vc_ctrl_req) {
0756ad15b1fef2 zhenwei pi 2022-05-06 125 err = -ENOMEM;
0756ad15b1fef2 zhenwei pi 2022-05-06 126 goto out;
0756ad15b1fef2 zhenwei pi 2022-05-06 127 }
0756ad15b1fef2 zhenwei pi 2022-05-06 128
0756ad15b1fef2 zhenwei pi 2022-05-06 129 ctrl = &vc_ctrl_req->ctrl;
6fd763d155860e zhenwei pi 2022-05-06 130 memcpy(&ctrl->header, header, sizeof(ctrl->header));
6fd763d155860e zhenwei pi 2022-05-06 @131 memcpy(&ctrl->u, para, sizeof(ctrl->u));
0756ad15b1fef2 zhenwei pi 2022-05-06 132 input = &vc_ctrl_req->input;
6fd763d155860e zhenwei pi 2022-05-06 133 input->status = cpu_to_le32(VIRTIO_CRYPTO_ERR);
59ca6c93387d32 zhenwei pi 2022-03-02 134
6fd763d155860e zhenwei pi 2022-05-06 135 sg_init_one(&outhdr_sg, ctrl, sizeof(*ctrl));
59ca6c93387d32 zhenwei pi 2022-03-02 136 sgs[num_out++] = &outhdr_sg;
59ca6c93387d32 zhenwei pi 2022-03-02 137
59ca6c93387d32 zhenwei pi 2022-03-02 138 sg_init_one(&key_sg, pkey, keylen);
59ca6c93387d32 zhenwei pi 2022-03-02 139 sgs[num_out++] = &key_sg;
59ca6c93387d32 zhenwei pi 2022-03-02 140
6fd763d155860e zhenwei pi 2022-05-06 141 sg_init_one(&inhdr_sg, input, sizeof(*input));
59ca6c93387d32 zhenwei pi 2022-03-02 142 sgs[num_out + num_in++] = &inhdr_sg;
59ca6c93387d32 zhenwei pi 2022-03-02 143
977231e8d45657 zhenwei pi 2022-05-06 144 err = virtio_crypto_ctrl_vq_request(vcrypto, sgs, num_out, num_in, vc_ctrl_req);
977231e8d45657 zhenwei pi 2022-05-06 145 if (err < 0)
59ca6c93387d32 zhenwei pi 2022-03-02 146 goto out;
59ca6c93387d32 zhenwei pi 2022-03-02 147
6fd763d155860e zhenwei pi 2022-05-06 148 if (le32_to_cpu(input->status) != VIRTIO_CRYPTO_OK) {
0756ad15b1fef2 zhenwei pi 2022-05-06 149 pr_err("virtio_crypto: Create session failed status: %u\n",
0756ad15b1fef2 zhenwei pi 2022-05-06 150 le32_to_cpu(input->status));
59ca6c93387d32 zhenwei pi 2022-03-02 151 err = -EINVAL;
59ca6c93387d32 zhenwei pi 2022-03-02 152 goto out;
59ca6c93387d32 zhenwei pi 2022-03-02 153 }
59ca6c93387d32 zhenwei pi 2022-03-02 154
6fd763d155860e zhenwei pi 2022-05-06 155 ctx->session_id = le64_to_cpu(input->session_id);
59ca6c93387d32 zhenwei pi 2022-03-02 156 ctx->session_valid = true;
59ca6c93387d32 zhenwei pi 2022-03-02 157 err = 0;
59ca6c93387d32 zhenwei pi 2022-03-02 158
59ca6c93387d32 zhenwei pi 2022-03-02 159 out:
0756ad15b1fef2 zhenwei pi 2022-05-06 160 kfree(vc_ctrl_req);
59ca6c93387d32 zhenwei pi 2022-03-02 161 kfree_sensitive(pkey);
59ca6c93387d32 zhenwei pi 2022-03-02 162
59ca6c93387d32 zhenwei pi 2022-03-02 163 return err;
59ca6c93387d32 zhenwei pi 2022-03-02 164 }
59ca6c93387d32 zhenwei pi 2022-03-02 165
:::::: The code at line 131 was first introduced by commit
:::::: 6fd763d155860eb7ea3a93c8b3bf926940ffa3fb virtio-crypto: change code style
:::::: TO: zhenwei pi <pizhenwei@bytedance.com>
:::::: CC: Michael S. Tsirkin <mst@redhat.com>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-05-27 6:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-27 6:53 [zen:6.3/zen-sauce 8/30] drivers/crypto/virtio/virtio_crypto_akcipher_algs.c:131:9: warning: 'memcpy' reading 56 bytes from a region of size 20 kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.