From nobody Tue May 7 20:17:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=amsat.org ARC-Seal: i=1; a=rsa-sha256; t=1593416910; cv=none; d=zohomail.com; s=zohoarc; b=dLdRsbip90L6b3y2aZ0Z37VoM00EUSJgXswGcgNGBW1xKCB0RtfPRmpyi3d4mjNG9vxjolf6VMY2YYG1DDb53WkNQKbVe9LJ640gkyeYr1irkF4pCF1ltNUgDLXhcwppsA+NPz/TJMZYRl0BUhXVwxfIDV60e8dFvYRngnVWWZY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593416910; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=EA3g3jLnXIf8aJQnmpGkok4BIBubDKvqorlCoqvInNc=; b=UU1nO4BXQuo8fbWZQ5Q0Nxtri4o1/IAvFUxc9uGNQaejlUdQpdkuA7fI99bBTpYlUPEMzSesZteIdBJPh6cT+4ICUjV5eRJE9uhD0y3PbtAGaTSfBsny/ciTrlAtrxT3FfYZsp7qfj5PMYoXd209nO8V0+9MpTqmXPYkPHmecKk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 159341691033091.98418485417835; Mon, 29 Jun 2020 00:48:30 -0700 (PDT) Received: from localhost ([::1]:53866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jpoWi-0007rK-Bj for importer@patchew.org; Mon, 29 Jun 2020 03:48:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jpoVR-0007HA-Ua; Mon, 29 Jun 2020 03:47:09 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:38693) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jpoVQ-0005oH-CD; Mon, 29 Jun 2020 03:47:09 -0400 Received: by mail-wm1-x341.google.com with SMTP id f18so15117690wml.3; Mon, 29 Jun 2020 00:47:07 -0700 (PDT) Received: from localhost.localdomain (1.red-83-51-162.dynamicip.rima-tde.net. [83.51.162.1]) by smtp.gmail.com with ESMTPSA id s18sm52669882wra.85.2020.06.29.00.47.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 00:47:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EA3g3jLnXIf8aJQnmpGkok4BIBubDKvqorlCoqvInNc=; b=GgqZeVv1g2WzGD/TcD4LTFjBt+K76p+b69GXhImbCVfGLiKfVY5LJSYYHH+1A/6z+z PL9Ap7HFaMedyT+P1hOrgFCezdVWIfqcCWKC77K3yOF2VIVZQZVKeOl6EiRFdBX1wBwr 11vkbm0KyuD7vi5B20UmcjFCF/5XGJYn/fvKUH+8uplefdKFgaVBriQm4fAAAUkabVzu GzzyvB9naPdJrnUOHxiLR6ADQ/3wiUP0tmHkPO0cdE+OimJCYcex9SZFtQTGw4VBVvZo s/yYEOlybbguQ1ghDLhMFemj5AYa8wLbQCrOLoqfg8zSH26VHvFWh59HXkd92MrpxxVb vF5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=EA3g3jLnXIf8aJQnmpGkok4BIBubDKvqorlCoqvInNc=; b=HdATvg9pSh8K6pXbfhuCbzJVmIOlxWnNMNSn8V6e0TpQxHuJ39Jzfb2vBmCDCNcKUO SeaSbYOuoCxJ6vZLci1yQW9lRHxiGPFIym3vZ4aurEmh2WxajyhySDN+SNZQ7SWEGsBM LACPG9GQw9NoxOc6AeThbi2C1+wymZU/xO8T3bT3dbecefnTHqfmlZv9tkO1TjDMrZdQ W76xMPtgR8yj10DuzHwqfoctrj/rgGdTeKDLT62an+FKAPbM5P0aYmpeZohBj7rPj+u0 qUQU8cPXanqLLDRb+T5KCLwXUVA+lGRu2CWQ2m6r7bpHGTcwWk5NnmUgjvfVwCAZwdNj YZdg== X-Gm-Message-State: AOAM5303AL+hx9AcbLS9S3Q7lxsGuOQH9obXcONl4c7O0bjroYqGUYl3 sCcViZHrImOh3cx2ceH+S+I= X-Google-Smtp-Source: ABdhPJyjZta09C71AW+7Q1Z0AfyZirv88WpXilkS7kzq3jUN5xnllpSWFYmEhR0cCQ1FNC82bFeBeg== X-Received: by 2002:a7b:c0c9:: with SMTP id s9mr14564257wmh.166.1593416826514; Mon, 29 Jun 2020 00:47:06 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Jean-Christophe DUBOIS , qemu-devel@nongnu.org Subject: [PATCH] hw/misc/pca9552: Add missing TypeInfo::class_size field Date: Mon, 29 Jun 2020 09:47:04 +0200 Message-Id: <20200629074704.23028-1-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::341; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x341.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jeffery , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Joel Stanley Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) When adding the generic PCA955xClass in commit 736132e455, we forgot to set the class_size field. Fill it now to avoid: (gdb) run -machine mcimx6ul-evk -m 128M -display none -serial stdio -kern= el ./OS.elf Starting program: ../../qemu/qemu/arm-softmmu/qemu-system-arm -machine mc= imx6ul-evk -m 128M -display none -serial stdio -kernel ./OS.elf double free or corruption (!prev) Thread 1 "qemu-system-arm" received signal SIGABRT, Aborted. __GI_raise (sig=3Dsig@entry=3D6) at ../sysdeps/unix/sysv/linux/raise.c:50 (gdb) where #0 __GI_raise (sig=3Dsig@entry=3D6) at ../sysdeps/unix/sysv/linux/raise.= c:50 #1 0x00007ffff75d8859 in __GI_abort () at abort.c:79 #2 0x00007ffff76433ee in __libc_message (action=3Daction@entry=3Ddo_abort, fmt=3Dfmt@entry=3D0x7ffff776d285 "= %s\n") at ../sysdeps/posix/libc_fatal.c:155 #3 0x00007ffff764b47c in malloc_printerr (str=3Dstr@entry=3D0x7ffff776f690 "double free or corruption (!prev)") at malloc.c:5347 #4 0x00007ffff764d12c in _int_free (av=3D0x7ffff779eb80 , p=3D0x5555567a3990, have_lock=3D) at malloc.c:4317 #5 0x0000555555c906c3 in type_initialize_interface (ti=3Dti@entry=3D0x5555565b8f40, interface_type=3D0x555556597ad0, par= ent_type=3D0x55555662ca10) at qom/object.c:259 #6 0x0000555555c902da in type_initialize (ti=3Dti@entry=3D0x5555565b8f40) at qom/object.c:323 #7 0x0000555555c90d20 in type_initialize (ti=3D0x5555565b8f40) at qom/object.c:1028 $ valgrind --track-origins=3Dyes qemu-system-arm -M mcimx6ul-evk -m 128M = -display none -serial stdio -kernel ./OS.elf =3D=3D77479=3D=3D Memcheck, a memory error detector =3D=3D77479=3D=3D Copyright (C) 2002-2017, and GNU GPL'd, by Julian Sewar= d et al. =3D=3D77479=3D=3D Using Valgrind-3.15.0 and LibVEX; rerun with -h for cop= yright info =3D=3D77479=3D=3D Command: qemu-system-arm -M mcimx6ul-evk -m 128M -displ= ay none -serial stdio -kernel ./OS.elf =3D=3D77479=3D=3D =3D=3D77479=3D=3D Invalid write of size 2 =3D=3D77479=3D=3D at 0x6D8322: pca9552_class_init (pca9552.c:424) =3D=3D77479=3D=3D by 0x844D1F: type_initialize (object.c:1029) =3D=3D77479=3D=3D by 0x844D1F: object_class_foreach_tramp (object.c:10= 16) =3D=3D77479=3D=3D by 0x4AE1057: g_hash_table_foreach (in /usr/lib/x86_= 64-linux-gnu/libglib-2.0.so.0.6400.2) =3D=3D77479=3D=3D by 0x8453A4: object_class_foreach (object.c:1038) =3D=3D77479=3D=3D by 0x8453A4: object_class_get_list (object.c:1095) =3D=3D77479=3D=3D by 0x556194: select_machine (vl.c:2416) =3D=3D77479=3D=3D by 0x556194: qemu_init (vl.c:3828) =3D=3D77479=3D=3D by 0x40AF9C: main (main.c:48) =3D=3D77479=3D=3D Address 0x583f108 is 0 bytes after a block of size 200= alloc'd =3D=3D77479=3D=3D at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/v= algrind/vgpreload_memcheck-amd64-linux.so) =3D=3D77479=3D=3D by 0x4AF8D30: g_malloc0 (in /usr/lib/x86_64-linux-gn= u/libglib-2.0.so.0.6400.2) =3D=3D77479=3D=3D by 0x844258: type_initialize.part.0 (object.c:306) =3D=3D77479=3D=3D by 0x844D1F: type_initialize (object.c:1029) =3D=3D77479=3D=3D by 0x844D1F: object_class_foreach_tramp (object.c:10= 16) =3D=3D77479=3D=3D by 0x4AE1057: g_hash_table_foreach (in /usr/lib/x86_= 64-linux-gnu/libglib-2.0.so.0.6400.2) =3D=3D77479=3D=3D by 0x8453A4: object_class_foreach (object.c:1038) =3D=3D77479=3D=3D by 0x8453A4: object_class_get_list (object.c:1095) =3D=3D77479=3D=3D by 0x556194: select_machine (vl.c:2416) =3D=3D77479=3D=3D by 0x556194: qemu_init (vl.c:3828) =3D=3D77479=3D=3D by 0x40AF9C: main (main.c:48) Fixes: 736132e455 ("hw/misc/pca9552: Add generic PCA955xClass") Reported-by: Jean-Christophe DUBOIS Signed-off-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Jean-Christophe DUBOIS --- hw/misc/pca9552.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/misc/pca9552.c b/hw/misc/pca9552.c index 80caa9ec8f..68b574d084 100644 --- a/hw/misc/pca9552.c +++ b/hw/misc/pca9552.c @@ -410,6 +410,7 @@ static const TypeInfo pca955x_info =3D { .instance_init =3D pca955x_initfn, .instance_size =3D sizeof(PCA955xState), .class_init =3D pca955x_class_init, + .class_size =3D sizeof(PCA955xClass), .abstract =3D true, }; =20 --=20 2.21.3