Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools/testing/crypto: Use vzalloc instead of vmalloc+memset

This fixes the corresponding coccinelle warning.

Signed-off-by: Siddh Raman Pant <code@siddh.me>
Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Link: https://lore.kernel.org/r/20220627075148.140705-1-code@siddh.me
[agordeev@linux.ibm.com added Link]
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>

authored by

Siddh Raman Pant and committed by
Alexander Gordeev
5352ebf7 a111daf0

+3 -6
+3 -6
tools/testing/crypto/chacha20-s390/test-cipher.c
··· 252 252 memset(plain, 'a', data_size); 253 253 get_random_bytes(plain, (data_size > 256 ? 256 : data_size)); 254 254 255 - cipher_generic = vmalloc(data_size); 255 + cipher_generic = vzalloc(data_size); 256 256 if (!cipher_generic) { 257 257 pr_info("could not allocate cipher_generic buffer\n"); 258 258 ret = -2; 259 259 goto out; 260 260 } 261 - memset(cipher_generic, 0, data_size); 262 261 263 - cipher_s390 = vmalloc(data_size); 262 + cipher_s390 = vzalloc(data_size); 264 263 if (!cipher_s390) { 265 264 pr_info("could not allocate cipher_s390 buffer\n"); 266 265 ret = -2; 267 266 goto out; 268 267 } 269 - memset(cipher_s390, 0, data_size); 270 268 271 - revert = vmalloc(data_size); 269 + revert = vzalloc(data_size); 272 270 if (!revert) { 273 271 pr_info("could not allocate revert buffer\n"); 274 272 ret = -2; 275 273 goto out; 276 274 } 277 - memset(revert, 0, data_size); 278 275 279 276 if (debug) 280 277 print_hex_dump(KERN_INFO, "src: ", DUMP_PREFIX_OFFSET,