fuzz-e1000e-test.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * QTest testcase for e1000e device generated by fuzzer
  3. *
  4. * Copyright (c) 2021 Red Hat, Inc.
  5. *
  6. * SPDX-License-Identifier: GPL-2.0-or-later
  7. */
  8. #include "qemu/osdep.h"
  9. #include "libqtest.h"
  10. /*
  11. * https://bugs.launchpad.net/qemu/+bug/1879531
  12. */
  13. static void test_lp1879531_eth_get_rss_ex_dst_addr(void)
  14. {
  15. QTestState *s;
  16. s = qtest_init("-nographic -monitor none -serial none -M pc-q35-5.0");
  17. qtest_outl(s, 0xcf8, 0x80001010);
  18. qtest_outl(s, 0xcfc, 0xe1020000);
  19. qtest_outl(s, 0xcf8, 0x80001004);
  20. qtest_outw(s, 0xcfc, 0x7);
  21. qtest_writeb(s, 0x25, 0x86);
  22. qtest_writeb(s, 0x26, 0xdd);
  23. qtest_writeb(s, 0x4f, 0x2b);
  24. qtest_writel(s, 0xe1020030, 0x190002e1);
  25. qtest_writew(s, 0xe102003a, 0x0807);
  26. qtest_writel(s, 0xe1020048, 0x12077cdd);
  27. qtest_writel(s, 0xe1020400, 0xba077cdd);
  28. qtest_writel(s, 0xe1020420, 0x190002e1);
  29. qtest_writel(s, 0xe1020428, 0x3509d807);
  30. qtest_writeb(s, 0xe1020438, 0xe2);
  31. qtest_writeb(s, 0x4f, 0x2b);
  32. qtest_quit(s);
  33. }
  34. int main(int argc, char **argv)
  35. {
  36. const char *arch = qtest_get_arch();
  37. g_test_init(&argc, &argv, NULL);
  38. if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
  39. qtest_add_func("fuzz/test_lp1879531_eth_get_rss_ex_dst_addr",
  40. test_lp1879531_eth_get_rss_ex_dst_addr);
  41. }
  42. return g_test_run();
  43. }