crypto/scompress.c:174:38: warning: unused variable 'dst_page'
Subsystems (2)
kernel test robot
build bottree: 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/[email protected]/config) compiler: loongarch64-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240309/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
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
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Quoted 36 lines
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/[email protected]/config) compiler: loongarch64-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240309/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/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':Quoted 1 line
Quoted 1 line
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.c112 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); [snipped] 171 } else { 172 int nr_pages = DIV_ROUND_UP(req->dst->offset + req->dlen, PAGE_SIZE); 173 int i;
Quoted 4 lines
Quoted 1 line
174 struct page
*dst_page=sg_page(req->dst);175
176 for (i = 0; i <nr_pages; i++)
177flush_dcache_page(dst_page + i);
+ Huacai, Xuerui
loongarch code needs a fix, it should have removed the below two macros:
arch/loongarch/include/asm/cacheflush.h +0 -3
@@ -37,8 +37,6 @@ void local_flush_icache_range(unsigned long start, unsigned long end);#define flush_icache_range local_flush_icache_range#define flush_icache_user_range local_flush_icache_range -#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 -#define flush_cache_all () do { } while (0)#define flush_cache_mm (mm) do { } while (0)#define flush_cache_dup_mm (mm) do { } while (0)
@@ -47,7 +45,6 @@ void local_flush_icache_range(unsigned long start, unsigned long end);#define flush_cache_vmap (start, end) do { } while (0)#define flush_cache_vunmap (start, end) do { } while (0)#define flush_icache_user_page (vma, page, addr, len) do { } while (0) -#define flush_dcache_page (page) do { } while (0)#define flush_dcache_mmap_lock (mapping) do { } while (0)#define flush_dcache_mmap_unlock (mapping) do { } while (0)
as include/asm-generic/cacheflush.h already has the below,
#ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE static inline void flush_dcache_page(struct page *page) {
}
#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
#endif
Quoted 11 lines
178 } 179 } 180 out: 181 spin_unlock(&scratch->lock); 182 return ret; 183 } 184Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Thanks
Barry
Huacai Chen
maintainerHi, Barry,
Quoted 42 lines · Barry Song
Quoted 37 lines
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/[email protected]/config) compiler: loongarch64-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240309/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/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':Quoted 1 line
Quoted 1 line
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.c112 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); [snipped] 171 } else { 172 int nr_pages = DIV_ROUND_UP(req->dst->offset + req->dlen, PAGE_SIZE); 173 int i;Quoted 4 lines
Quoted 1 line
174 struct page
*dst_page=sg_page(req->dst);175
176 for (i = 0; i <nr_pages; i++)
177flush_dcache_page(dst_page + i);
Quoted 4 lines
+ Huacai, Xuerui
loongarch code needs a fix, it should have removed the below two macros:
OK, seems reasonable.
Huacai
Quoted 48 lines
arch/loongarch/include/asm/cacheflush.h +0
-3@@ -37,8 +37,6 @@ void local_flush_icache_range(unsigned long start, unsigned long end);#define flush_icache_range local_flush_icache_range#define flush_icache_user_range local_flush_icache_range -#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 -#define flush_cache_all () do { } while (0)#define flush_cache_mm (mm) do { } while (0)#define flush_cache_dup_mm (mm) do { } while (0)@@ -47,7 +45,6 @@ void local_flush_icache_range(unsigned long start, unsigned long end);#define flush_cache_vmap (start, end) do { } while (0)#define flush_cache_vunmap (start, end) do { } while (0)#define flush_icache_user_page (vma, page, addr, len) do { } while (0) -#define flush_dcache_page (page) do { } while (0)#define flush_dcache_mmap_lock (mapping) do { } while (0)#define flush_dcache_mmap_unlock (mapping) do { } while (0)as
include/asm-generic/cacheflush.halready has the below,#ifndef
ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGEstatic inline voidflush_dcache_page(struct page *page){
}#define
ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE0
#endifQuoted 11 lines
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/wikiThanks
Barry