Revision d315353bed0ee4f4a505b8c5fdf24dc63659ae92 authored by Max Reitz on 28 February 2018, 13:13:14 UTC, committed by Michael Roth on 21 June 2018, 01:45:01 UTC
Storing the lseek() result in an int results in it overflowing when the
file is at least 2 GB big.  Then, we have a 50 % chance of the result
being "negative" and thus thinking an error occurred when actually
everything went just fine.

So we should use the correct type for storing the result: off_t.

Reported-by: Daniel P. Berrange <berrange@redhat.com>
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1549231
Cc: qemu-stable@nongnu.org
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20180228131315.30194-2-mreitz@redhat.com
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
(cherry picked from commit 82b45e0a0b824787bd79ce3f6453eaa2afddd138)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
1 parent 332969a
Raw File
intel-hda-test.c
/*
 * QTest testcase for Intel HDA
 *
 * Copyright (c) 2014 SUSE LINUX Products GmbH
 *
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 * See the COPYING file in the top-level directory.
 */

#include "qemu/osdep.h"
#include "libqtest.h"

#define HDA_ID "hda0"
#define CODEC_DEVICES " -device hda-output,bus=" HDA_ID ".0" \
                      " -device hda-micro,bus=" HDA_ID ".0" \
                      " -device hda-duplex,bus=" HDA_ID ".0"

/* Tests only initialization so far. TODO: Replace with functional tests */
static void ich6_test(void)
{
    qtest_start("-device intel-hda,id=" HDA_ID CODEC_DEVICES);
    qtest_end();
}

static void ich9_test(void)
{
    qtest_start("-machine q35 -device ich9-intel-hda,bus=pcie.0,addr=1b.0,id="
                HDA_ID CODEC_DEVICES);
    qtest_end();
}

int main(int argc, char **argv)
{
    g_test_init(&argc, &argv, NULL);
    qtest_add_func("/intel-hda/ich6", ich6_test);
    qtest_add_func("/intel-hda/ich9", ich9_test);

    return g_test_run();
}
back to top