tree: https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master head: 77292bb8ca69c808741aadbd29207605296e24af commit: 77292bb8ca69c808741aadbd29207605296e24af [80/80] crypto: scomp - remove memcpy if sg_nents is 1 and pages are lowmem config: loongarch-defconfig (https://download.01.org/0day-ci/archive/20240309/202403091614.NeUw5zcv-lkp@xxxxxxxxx/config) compiler: loongarch64-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240309/202403091614.NeUw5zcv-lkp@xxxxxxxxx/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@xxxxxxxxx> | Closes: https://lore.kernel.org/oe-kbuild-all/202403091614.NeUw5zcv-lkp@xxxxxxxxx/ All warnings (new ones prefixed by >>): In file included from crypto/scompress.c:12: include/crypto/scatterwalk.h: In function 'scatterwalk_pagedone': include/crypto/scatterwalk.h:76:30: warning: variable 'page' set but not used [-Wunused-but-set-variable] 76 | struct page *page; | ^~~~ crypto/scompress.c: In function 'scomp_acomp_comp_decomp': >> crypto/scompress.c:174:38: warning: unused variable 'dst_page' [-Wunused-variable] 174 | struct page *dst_page = sg_page(req->dst); | ^~~~~~~~ vim +/dst_page +174 crypto/scompress.c 112 113 static int scomp_acomp_comp_decomp(struct acomp_req *req, int dir) 114 { 115 struct crypto_acomp *tfm = crypto_acomp_reqtfm(req); 116 void **tfm_ctx = acomp_tfm_ctx(tfm); 117 struct crypto_scomp *scomp = *tfm_ctx; 118 void **ctx = acomp_request_ctx(req); 119 struct scomp_scratch *scratch; 120 void *src, *dst; 121 unsigned int dlen; 122 int ret; 123 124 if (!req->src || !req->slen || req->slen > SCOMP_SCRATCH_SIZE) 125 return -EINVAL; 126 127 if (req->dst && !req->dlen) 128 return -EINVAL; 129 130 if (!req->dlen || req->dlen > SCOMP_SCRATCH_SIZE) 131 req->dlen = SCOMP_SCRATCH_SIZE; 132 133 dlen = req->dlen; 134 135 scratch = raw_cpu_ptr(&scomp_scratch); 136 spin_lock(&scratch->lock); 137 138 if (sg_nents(req->src) == 1 && !PageHighMem(sg_page(req->src))) { 139 src = page_to_virt(sg_page(req->src)) + req->src->offset; 140 } else { 141 scatterwalk_map_and_copy(scratch->src, req->src, 0, 142 req->slen, 0); 143 src = scratch->src; 144 } 145 146 if (req->dst && sg_nents(req->dst) == 1 && !PageHighMem(sg_page(req->dst))) 147 dst = page_to_virt(sg_page(req->dst)) + req->dst->offset; 148 else 149 dst = scratch->dst; 150 151 if (dir) 152 ret = crypto_scomp_compress(scomp, src, req->slen, 153 dst, &req->dlen, *ctx); 154 else 155 ret = crypto_scomp_decompress(scomp, src, req->slen, 156 dst, &req->dlen, *ctx); 157 if (!ret) { 158 if (!req->dst) { 159 req->dst = sgl_alloc(req->dlen, GFP_ATOMIC, NULL); 160 if (!req->dst) { 161 ret = -ENOMEM; 162 goto out; 163 } 164 } else if (req->dlen > dlen) { 165 ret = -ENOSPC; 166 goto out; 167 } 168 if (dst == scratch->dst) { 169 scatterwalk_map_and_copy(scratch->dst, req->dst, 0, 170 req->dlen, 1); 171 } else { 172 int nr_pages = DIV_ROUND_UP(req->dst->offset + req->dlen, PAGE_SIZE); 173 int i; > 174 struct page *dst_page = sg_page(req->dst); 175 176 for (i = 0; i < nr_pages; i++) 177 flush_dcache_page(dst_page + i); 178 } 179 } 180 out: 181 spin_unlock(&scratch->lock); 182 return ret; 183 } 184 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki