Skip to content

Commit

Permalink
qtest: Use strtoull() for uint64_t
Browse files Browse the repository at this point in the history
On 32-bit hosts, unsigned long may be uint32_t and uint64_t may be
unsigned long long. Account for this by always using strtoull().
We were already using strtoll() for int64_t.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1360600914-5448-2-git-send-email-afaerber@suse.de
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
  • Loading branch information
afaerber authored and Anthony Liguori committed Feb 11, 2013
1 parent 84eac31 commit 5dd6be0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions qtest.c
Expand Up @@ -282,8 +282,8 @@ static void qtest_process_command(CharDriverState *chr, gchar **words)
uint8_t *data;

g_assert(words[1] && words[2]);
addr = strtoul(words[1], NULL, 0);
len = strtoul(words[2], NULL, 0);
addr = strtoull(words[1], NULL, 0);
len = strtoull(words[2], NULL, 0);

data = g_malloc(len);
cpu_physical_memory_read(addr, data, len);
Expand All @@ -302,8 +302,8 @@ static void qtest_process_command(CharDriverState *chr, gchar **words)
size_t data_len;

g_assert(words[1] && words[2] && words[3]);
addr = strtoul(words[1], NULL, 0);
len = strtoul(words[2], NULL, 0);
addr = strtoull(words[1], NULL, 0);
len = strtoull(words[2], NULL, 0);

data_len = strlen(words[3]);
if (data_len < 3) {
Expand Down

0 comments on commit 5dd6be0

Please sign in to comment.