Re: [kvm-unit-tests PATCH 3/9] s390x: topology: Fix parsing loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/11/23 10:56, Nina Schoetterl-Glausch wrote:
Without a comparison the loop is infinite.

Signed-off-by: Nina Schoetterl-Glausch <nsg@xxxxxxxxxxxxx>

Wait, how did this work before this change?
Did the strcmp effectively end the loop?

---
  s390x/topology.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/s390x/topology.c b/s390x/topology.c
index e1bb6014..49d6dfeb 100644
--- a/s390x/topology.c
+++ b/s390x/topology.c
@@ -466,7 +466,7 @@ static void parse_topology_args(int argc, char **argv)
  		if (flag[0] != '-')
  			report_abort("Argument is expected to begin with '-'");
  		flag++;
-		for (level = 0; ARRAY_SIZE(levels); level++) {
+		for (level = 0; level < ARRAY_SIZE(levels); level++) {
  			if (!strcmp(levels[level], flag))
  				break;
  		}




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux