As explained in HACKING, the g_malloc(sizeof(T) * n) construct is unsafe because it can't detect multiplication overflowing size_t and doesn't allow type checking.
It appears to be used in a bunch of places though: $ git grep -E 'malloc.*sizeof' | grep ' \* ' | wc -l 101 This series fixes the ppc target and ppc machine code. The changes are mostly trivial. Only the mac99 and e500 machines required some more work that should be reviewed carefully, as it was only compile-tested. -- Greg --- Greg Kurz (9): target/ppc: use g_new(T, n) instead of g_malloc(sizeof(T) * n) spapr: use g_new(T, n) instead of g_malloc(sizeof(T) * n) ppc405_boards: use g_new(T, n) instead of g_malloc(sizeof(T) * n) ppc405_uc: use g_new(T, n) instead of g_malloc(sizeof(T) * n) ppc440_bamboo: use g_new(T, n) instead of g_malloc(sizeof(T) * n) sam460ex: use g_new(T, n) instead of g_malloc(sizeof(T) * n) virtex_ml507: use g_new(T, n) instead of g_malloc(sizeof(T) * n) mac_newworld: simplify IRQ wiring e500: simplify IRQ wiring hw/ppc/e500.c | 18 ++++++++---------- hw/ppc/mac_newworld.c | 30 +++++++++++++----------------- hw/ppc/ppc405_boards.c | 4 ++-- hw/ppc/ppc405_uc.c | 4 ++-- hw/ppc/ppc440_bamboo.c | 5 ++--- hw/ppc/sam460ex.c | 2 +- hw/ppc/spapr_iommu.c | 2 +- hw/ppc/spapr_vio.c | 2 +- hw/ppc/virtex_ml507.c | 2 +- include/hw/ppc/openpic.h | 2 ++ target/ppc/translate_init.inc.c | 6 +++--- 11 files changed, 36 insertions(+), 41 deletions(-)