It's not a big deal, but 'check qtest-ppc/ppc64' runs fail if sanitizers is enabled. The memory leak stack is as follow: Direct leak of 128 byte(s) in 4 object(s) allocated from: #0 0x7f11756f5970 in __interceptor_calloc (/lib64/libasan.so.5+0xef970) #1 0x7f1174f2549d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5249d) #2 0x556af05aa7da in mm_fw_cfg_init /mnt/sdb/qemu/tests/libqos/fw_cfg.c:119 #3 0x556af059f4f5 in read_boot_order_pmac /mnt/sdb/qemu/tests/boot-order-test.c:137 #4 0x556af059efe2 in test_a_boot_order /mnt/sdb/qemu/tests/boot-order-test.c:47 #5 0x556af059f2c0 in test_boot_orders /mnt/sdb/qemu/tests/boot-order-test.c:59 #6 0x556af059f52d in test_pmac_oldworld_boot_order /mnt/sdb/qemu/tests/boot-order-test.c:152 #7 0x7f1174f46cb9 (/lib64/libglib-2.0.so.0+0x73cb9) #8 0x7f1174f46b73 (/lib64/libglib-2.0.so.0+0x73b73) #9 0x7f1174f46b73 (/lib64/libglib-2.0.so.0+0x73b73) #10 0x7f1174f46f71 in g_test_run_suite (/lib64/libglib-2.0.so.0+0x73f71) #11 0x7f1174f46f94 in g_test_run (/lib64/libglib-2.0.so.0+0x73f94) Reported-by: Euler Robot <euler.robot@huawei.com> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com> Message-Id: <20200203025935.36228-1-pannengyuan@huawei.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
55 lines
1.4 KiB
C
55 lines
1.4 KiB
C
/*
|
|
* libqos fw_cfg support
|
|
*
|
|
* Copyright IBM, Corp. 2012-2013
|
|
*
|
|
* Authors:
|
|
* Anthony Liguori <aliguori@us.ibm.com>
|
|
*
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
* See the COPYING file in the top-level directory.
|
|
*/
|
|
|
|
#ifndef LIBQOS_FW_CFG_H
|
|
#define LIBQOS_FW_CFG_H
|
|
|
|
#include "libqtest.h"
|
|
|
|
typedef struct QFWCFG QFWCFG;
|
|
|
|
struct QFWCFG
|
|
{
|
|
uint64_t base;
|
|
QTestState *qts;
|
|
void (*select)(QFWCFG *fw_cfg, uint16_t key);
|
|
void (*read)(QFWCFG *fw_cfg, void *data, size_t len);
|
|
};
|
|
|
|
void qfw_cfg_select(QFWCFG *fw_cfg, uint16_t key);
|
|
void qfw_cfg_read_data(QFWCFG *fw_cfg, void *data, size_t len);
|
|
void qfw_cfg_get(QFWCFG *fw_cfg, uint16_t key, void *data, size_t len);
|
|
uint16_t qfw_cfg_get_u16(QFWCFG *fw_cfg, uint16_t key);
|
|
uint32_t qfw_cfg_get_u32(QFWCFG *fw_cfg, uint16_t key);
|
|
uint64_t qfw_cfg_get_u64(QFWCFG *fw_cfg, uint16_t key);
|
|
size_t qfw_cfg_get_file(QFWCFG *fw_cfg, const char *filename,
|
|
void *data, size_t buflen);
|
|
|
|
QFWCFG *mm_fw_cfg_init(QTestState *qts, uint64_t base);
|
|
void mm_fw_cfg_uninit(QFWCFG *fw_cfg);
|
|
QFWCFG *io_fw_cfg_init(QTestState *qts, uint16_t base);
|
|
void io_fw_cfg_uninit(QFWCFG *fw_cfg);
|
|
|
|
static inline QFWCFG *pc_fw_cfg_init(QTestState *qts)
|
|
{
|
|
return io_fw_cfg_init(qts, 0x510);
|
|
}
|
|
|
|
static inline void pc_fw_cfg_uninit(QFWCFG *fw_cfg)
|
|
{
|
|
io_fw_cfg_uninit(fw_cfg);
|
|
}
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(QFWCFG, mm_fw_cfg_uninit)
|
|
|
|
#endif
|