summaryrefslogtreecommitdiff
path: root/util/id.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2015-12-04 10:55:03 +0000
committerPeter Maydell <peter.maydell@linaro.org>2015-12-04 10:55:03 +0000
commit61e3aa25b129b48d8a8cb851aae2a787af7ca5e1 (patch)
tree8f4736f6b89ce02748b96d9c0b4db24cf6959760 /util/id.c
parentf33d046d233084f908825bc1a4ec79f1796ca803 (diff)
parent98475746b357f6c048caf9e001998d8a0618b2e4 (diff)
downloadqemu-61e3aa25b129b48d8a8cb851aae2a787af7ca5e1.tar.gz
Merge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2015-12-04' into staging
trivial patches for 2015-12-04 # gpg: Signature made Fri 04 Dec 2015 06:40:23 GMT using RSA key ID A4C3D7DB # gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>" # gpg: aka "Michael Tokarev <mjt@corpit.ru>" # gpg: aka "Michael Tokarev <mjt@debian.org>" * remotes/mjt/tags/pull-trivial-patches-2015-12-04: bt: check struct sizes typedefs: Put them back into alphabetical order scsi: remove scsi_req_free prototype gt64xxx: fix decoding of ISD register configure: use appropriate code fragment for -fstack-protector checks crypto: avoid two coverity false positive error reports configure: Diagnose broken linkers directly bt: avoid unintended sign extension util/id: fully allocate names table Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'util/id.c')
-rw-r--r--util/id.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/util/id.c b/util/id.c
index bcc64d836f..7883fbec79 100644
--- a/util/id.c
+++ b/util/id.c
@@ -29,7 +29,7 @@ bool id_wellformed(const char *id)
#define ID_SPECIAL_CHAR '#'
-static const char *const id_subsys_str[] = {
+static const char *const id_subsys_str[ID_MAX] = {
[ID_QDEV] = "qdev",
[ID_BLOCK] = "block",
};
@@ -53,7 +53,7 @@ char *id_generate(IdSubSystems id)
static uint64_t id_counters[ID_MAX];
uint32_t rnd;
- assert(id < ID_MAX);
+ assert(id < ARRAY_SIZE(id_subsys_str));
assert(id_subsys_str[id]);
rnd = g_random_int_range(0, 100);