Skip to content

Commit f891221

Browse files
Jiapeng Chongsean-jc
authored andcommitted
KVM: selftests: Use ARRAY_SIZE for array length
Use of macro ARRAY_SIZE to calculate array size minimizes the redundant code and improves code reusability. ./tools/testing/selftests/kvm/x86_64/debug_regs.c:169:32-33: WARNING: Use ARRAY_SIZE. Reported-by: Abaci Robot <[email protected]> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=10847 Signed-off-by: Jiapeng Chong <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 600aa88 commit f891221

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/testing/selftests/kvm/x86_64/debug_regs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ int main(void)
166166
/* Test single step */
167167
target_rip = CAST_TO_RIP(ss_start);
168168
target_dr6 = 0xffff4ff0ULL;
169-
for (i = 0; i < (sizeof(ss_size) / sizeof(ss_size[0])); i++) {
169+
for (i = 0; i < ARRAY_SIZE(ss_size); i++) {
170170
target_rip += ss_size[i];
171171
memset(&debug, 0, sizeof(debug));
172172
debug.control = KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_SINGLESTEP |

0 commit comments

Comments
 (0)