From: patrick Date: Fri, 12 Jan 2018 10:33:07 +0000 (+0000) Subject: Correctly iterate over all extended signatures. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=03458aedfd633da83a93c7c37f03b86ef75da064;p=openbsd Correctly iterate over all extended signatures. Found by markus@ With sf@ --- diff --git a/sys/arch/amd64/amd64/ucode.c b/sys/arch/amd64/amd64/ucode.c index a52e3b49995..c0e1c6b6fa7 100644 --- a/sys/arch/amd64/amd64/ucode.c +++ b/sys/arch/amd64/amd64/ucode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ucode.c,v 1.1 2018/01/11 22:31:09 patrick Exp $ */ +/* $OpenBSD: ucode.c,v 1.2 2018/01/12 10:33:07 patrick Exp $ */ /* * Copyright (c) 2018 Stefan Fritsch * Copyright (c) 2018 Patrick Wildt @@ -260,6 +260,7 @@ cpu_ucode_intel_match(struct intel_ucode_header *hdr, struct intel_ucode_ext_sig_header *ehdr; struct intel_ucode_ext_sig *esig; uint32_t data_size, total_size; + unsigned i; data_size = hdr->data_size; total_size = hdr->total_size; @@ -286,10 +287,9 @@ cpu_ucode_intel_match(struct intel_ucode_header *hdr, ehdr = (void *)((char *)hdr + sizeof(struct intel_ucode_header) + data_size); esig = (void *)&ehdr[1]; - - for (unsigned i = 0; i < ehdr->ext_sig_count; i++) { - if (esig->processor_sig == processor_sig && - (esig->processor_flags & processor_mask)) + for (i = 0; i < ehdr->ext_sig_count; i++) { + if (esig[i].processor_sig == processor_sig && + (esig[i].processor_flags & processor_mask)) return 1; }