arch/powerpc/crypto/crc-vpmsum_test.c:106 crc_test_init() warn: inconsistent indenting
From: kernel test robot
Date: Mon Jul 06 2020 - 19:34:53 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: bfe91da29bfad9941d5d703d45e29f0812a20724
commit: 9f0acf9f80ad504573e6482fb00b53866a9b9d2f powerpc/crypto: Add cond_resched() in crc-vpmsum self-test
date: 8 months ago
config: powerpc-randconfig-m031-20200706 (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
smatch warnings:
arch/powerpc/crypto/crc-vpmsum_test.c:106 crc_test_init() warn: inconsistent indenting
vim +106 arch/powerpc/crypto/crc-vpmsum_test.c
20
21
22 static int __init crc_test_init(void)
23 {
24 u16 crc16 = 0, verify16 = 0;
25 u32 crc32 = 0, verify32 = 0;
26 __le32 verify32le = 0;
27 unsigned char *data;
28 unsigned long i;
29 int ret;
30
31 struct crypto_shash *crct10dif_tfm;
32 struct crypto_shash *crc32c_tfm;
33
34 if (!cpu_has_feature(CPU_FTR_ARCH_207S))
35 return -ENODEV;
36
37 data = kmalloc(MAX_CRC_LENGTH, GFP_KERNEL);
38 if (!data)
39 return -ENOMEM;
40
41 crct10dif_tfm = crypto_alloc_shash("crct10dif", 0, 0);
42
43 if (IS_ERR(crct10dif_tfm)) {
44 pr_err("Error allocating crc-t10dif\n");
45 goto free_buf;
46 }
47
48 crc32c_tfm = crypto_alloc_shash("crc32c", 0, 0);
49
50 if (IS_ERR(crc32c_tfm)) {
51 pr_err("Error allocating crc32c\n");
52 goto free_16;
53 }
54
55 do {
56 SHASH_DESC_ON_STACK(crct10dif_shash, crct10dif_tfm);
57 SHASH_DESC_ON_STACK(crc32c_shash, crc32c_tfm);
58
59 crct10dif_shash->tfm = crct10dif_tfm;
60 ret = crypto_shash_init(crct10dif_shash);
61
62 if (ret) {
63 pr_err("Error initing crc-t10dif\n");
64 goto free_32;
65 }
66
67
68 crc32c_shash->tfm = crc32c_tfm;
69 ret = crypto_shash_init(crc32c_shash);
70
71 if (ret) {
72 pr_err("Error initing crc32c\n");
73 goto free_32;
74 }
75
76 pr_info("crc-vpmsum_test begins, %lu iterations\n", iterations);
77 for (i=0; i<iterations; i++) {
78 size_t offset = prandom_u32_max(16);
79 size_t len = prandom_u32_max(MAX_CRC_LENGTH);
80
81 if (len <= offset)
82 continue;
83 prandom_bytes(data, len);
84 len -= offset;
85
86 crypto_shash_update(crct10dif_shash, data+offset, len);
87 crypto_shash_final(crct10dif_shash, (u8 *)(&crc16));
88 verify16 = crc_t10dif_generic(verify16, data+offset, len);
89
90
91 if (crc16 != verify16) {
92 pr_err("FAILURE in CRC16: got 0x%04x expected 0x%04x (len %lu)\n",
93 crc16, verify16, len);
94 break;
95 }
96
97 crypto_shash_update(crc32c_shash, data+offset, len);
98 crypto_shash_final(crc32c_shash, (u8 *)(&crc32));
99 verify32 = le32_to_cpu(verify32le);
100 verify32le = ~cpu_to_le32(__crc32c_le(~verify32, data+offset, len));
101 if (crc32 != (u32)verify32le) {
102 pr_err("FAILURE in CRC32: got 0x%08x expected 0x%08x (len %lu)\n",
103 crc32, verify32, len);
104 break;
105 }
> 106 cond_resched();
107 }
108 pr_info("crc-vpmsum_test done, completed %lu iterations\n", i);
109 } while (0);
110
111 free_32:
112 crypto_free_shash(crc32c_tfm);
113
114 free_16:
115 crypto_free_shash(crct10dif_tfm);
116
117 free_buf:
118 kfree(data);
119
120 return 0;
121 }
122
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip