From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 77D89C433EF for ; Mon, 14 Mar 2022 16:52:57 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.290344.492390 (Exim 4.92) (envelope-from ) id 1nTnw0-0004zU-QV; Mon, 14 Mar 2022 16:52:40 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 290344.492390; Mon, 14 Mar 2022 16:52:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nTnw0-0004zN-NV; Mon, 14 Mar 2022 16:52:40 +0000 Received: by outflank-mailman (input) for mailman id 290344; Mon, 14 Mar 2022 16:52:40 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nTnw0-0004zH-25 for xen-devel@lists.xenproject.org; Mon, 14 Mar 2022 16:52:40 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2769e280-a3b7-11ec-853b-5f4723681683; Mon, 14 Mar 2022 17:52:38 +0100 (CET) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-278-N1xO-bcsMhWHXGmr0LX6PA-1; Mon, 14 Mar 2022 12:52:36 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3E815801585; Mon, 14 Mar 2022 16:52:34 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.112.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5D70AC50942; Mon, 14 Mar 2022 16:52:33 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 30A6821E66C8; Mon, 14 Mar 2022 17:52:32 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 2769e280-a3b7-11ec-853b-5f4723681683 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647276757; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=hoVbdS414dD8S5HvfKlVfGNq0xYQ8aEfO5LCXtdVxms=; b=XG3499nnTatsMPDMTbFpCMpbjY6G1YBx3fWhZiqGJjID5p4RAhr4oXTc4kG9yTtNOwGtMK 3HbiGiVANS4sFip//5DAS7mPICDz1EyJ3ZtLdAtJwqzGGXq6TLvrqIxequ5aEgcOaLJ0dt 3IzzmQziLHa/oyRXAMD/iEQYw9I6DAg= X-MC-Unique: N1xO-bcsMhWHXGmr0LX6PA-1 From: Markus Armbruster To: Peter Maydell Cc: Markus Armbruster , qemu-devel@nongnu.org, Paolo Bonzini , Richard Henderson , Gerd Hoffmann , Christian Schoenebeck , "Gonglei (Arei)" , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , "Michael S. Tsirkin" , Igor Mammedov , Ani Sinha , Laurent Vivier , Amit Shah , Stefano Stabellini , Anthony Perard , Paul Durrant , =?utf-8?Q?Her?= =?utf-8?Q?v=C3=A9?= Poussineau , Aleksandar Rikalo , Corey Minyard , Patrick Venture , Eduardo Habkost , Marcel Apfelbaum , Peter Xu , Jason Wang , =?utf-8?Q?C=C3=A9dric?= Le Goater , Daniel Henrique Barboza , David Gibson , Greg Kurz , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Jean-Christophe Dubois , Keith Busch , Klaus Jensen , Yuval Shaia , Yoshinori Sato , Magnus Damm , Fabien Chouteau , KONRAD Frederic , Mark Cave-Ayland , Artyom Tarasenko , Alex Williamson , Eric Auger , Max Filippov , Juan Quintela , "Dr. David Alan Gilbert" , Konstantin Kostiuk , Michael Roth , Daniel P. =?utf-8?Q?Berrang=C3=A9?= , Pavel Dovgalyuk , Alex =?utf-8?Q?Benn=C3=A9e?= , David Hildenbrand , Wenchao Wang , Kamil Rytarowski , Reinoud Zandijk , Sunil Muthuswamy , Cornelia Huck , Thomas Huth , Eric Blake , Vladimir Sementsov-Ogievskiy , John Snow , kvm@vger.kernel.org, qemu-arm@nongnu.org, xen-devel@lists.xenproject.org, qemu-ppc@nongnu.org, qemu-block@nongnu.org, haxm-team@intel.com, qemu-s390x@nongnu.org Subject: Re: [PATCH 3/3] Use g_new() & friends where that makes obvious sense References: <20220314160108.1440470-1-armbru@redhat.com> <20220314160108.1440470-4-armbru@redhat.com> Date: Mon, 14 Mar 2022 17:52:32 +0100 In-Reply-To: (Peter Maydell's message of "Mon, 14 Mar 2022 16:08:15 +0000") Message-ID: <87k0cwqxwv.fsf@pond.sub.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Peter Maydell writes: > On Mon, 14 Mar 2022 at 16:01, Markus Armbruster wrote: >> >> g_new(T, n) is neater than g_malloc(sizeof(T) * n). It's also safer, >> for two reasons. One, it catches multiplication overflowing size_t. >> Two, it returns T * rather than void *, which lets the compiler catch >> more type errors. >> >> This commit only touches allocations with size arguments of the form >> sizeof(T). >> >> Patch created mechanically with: >> >> $ spatch --in-place --sp-file scripts/coccinelle/use-g_new-etc.cocci \ >> --macro-file scripts/cocci-macro-file.h FILES... >> >> Signed-off-by: Markus Armbruster >> --- > >> 104 files changed, 197 insertions(+), 202 deletions(-) > > I'm not going to say you must split this patch up. I'm just going to > say that I personally am not looking at it, because it's too big > for me to deal with. As with all big but trivial Coccinelle patches, reviewing the Coccinelle script and a reasonably representative sample of its output is almost certainly a better use of reviewer time than attempting to get all the patches reviewed. They are mind-numbingly dull! For what it's worth, we've used this script several times before. Last in commit bdd81addf4. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 722E5C433F5 for ; Mon, 14 Mar 2022 16:54:20 +0000 (UTC) Received: from localhost ([::1]:60868 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nTnxb-00083H-69 for qemu-devel@archiver.kernel.org; Mon, 14 Mar 2022 12:54:19 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59212) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTnw2-0006Mp-7j for qemu-devel@nongnu.org; Mon, 14 Mar 2022 12:52:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:41556) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTnvy-0001GH-Rd for qemu-devel@nongnu.org; Mon, 14 Mar 2022 12:52:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647276757; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=hoVbdS414dD8S5HvfKlVfGNq0xYQ8aEfO5LCXtdVxms=; b=XG3499nnTatsMPDMTbFpCMpbjY6G1YBx3fWhZiqGJjID5p4RAhr4oXTc4kG9yTtNOwGtMK 3HbiGiVANS4sFip//5DAS7mPICDz1EyJ3ZtLdAtJwqzGGXq6TLvrqIxequ5aEgcOaLJ0dt 3IzzmQziLHa/oyRXAMD/iEQYw9I6DAg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-278-N1xO-bcsMhWHXGmr0LX6PA-1; Mon, 14 Mar 2022 12:52:36 -0400 X-MC-Unique: N1xO-bcsMhWHXGmr0LX6PA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3E815801585; Mon, 14 Mar 2022 16:52:34 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.112.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5D70AC50942; Mon, 14 Mar 2022 16:52:33 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 30A6821E66C8; Mon, 14 Mar 2022 17:52:32 +0100 (CET) From: Markus Armbruster To: Peter Maydell Subject: Re: [PATCH 3/3] Use g_new() & friends where that makes obvious sense References: <20220314160108.1440470-1-armbru@redhat.com> <20220314160108.1440470-4-armbru@redhat.com> Date: Mon, 14 Mar 2022 17:52:32 +0100 In-Reply-To: (Peter Maydell's message of "Mon, 14 Mar 2022 16:08:15 +0000") Message-ID: <87k0cwqxwv.fsf@pond.sub.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Corey Minyard , Daniel Henrique Barboza , kvm@vger.kernel.org, "Michael S. Tsirkin" , Jason Wang , Christian Schoenebeck , qemu-devel@nongnu.org, Peter Xu , Klaus Jensen , KONRAD Frederic , Konstantin Kostiuk , Gerd Hoffmann , Ani Sinha , Reinoud Zandijk , Eric Blake , Sunil Muthuswamy , Stefano Stabellini , xen-devel@lists.xenproject.org, Yoshinori Sato , Juan Quintela , John Snow , Paul Durrant , Magnus Damm , Markus Armbruster , Kamil Rytarowski , "Gonglei \(Arei\)" , =?utf-8?Q?Her?= =?utf-8?Q?v=C3=A9?= Poussineau , Michael Roth , Anthony Perard , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , Artyom Tarasenko , Laurent Vivier , Aleksandar Rikalo , Amit Shah , Mark Cave-Ayland , haxm-team@intel.com, Richard Henderson , Greg Kurz , Fabien Chouteau , Yuval Shaia , Thomas Huth , Eric Auger , Alex Williamson , qemu-arm@nongnu.org, =?utf-8?Q?C=C3=A9dric?= Le Goater , Pavel Dovgalyuk , Paolo Bonzini , Keith Busch , David Hildenbrand , Alex =?utf-8?Q?Benn=C3=A9e?= , David Gibson , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , "Daniel P. =?utf-8?Q?Berrang=C3=A9?=" , qemu-block@nongnu.org, Max Filippov , qemu-s390x@nongnu.org, Patrick Venture , Cornelia Huck , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Jean-Christophe Dubois , qemu-ppc@nongnu.org, Wenchao Wang , Igor Mammedov , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Peter Maydell writes: > On Mon, 14 Mar 2022 at 16:01, Markus Armbruster wrote: >> >> g_new(T, n) is neater than g_malloc(sizeof(T) * n). It's also safer, >> for two reasons. One, it catches multiplication overflowing size_t. >> Two, it returns T * rather than void *, which lets the compiler catch >> more type errors. >> >> This commit only touches allocations with size arguments of the form >> sizeof(T). >> >> Patch created mechanically with: >> >> $ spatch --in-place --sp-file scripts/coccinelle/use-g_new-etc.cocci \ >> --macro-file scripts/cocci-macro-file.h FILES... >> >> Signed-off-by: Markus Armbruster >> --- > >> 104 files changed, 197 insertions(+), 202 deletions(-) > > I'm not going to say you must split this patch up. I'm just going to > say that I personally am not looking at it, because it's too big > for me to deal with. As with all big but trivial Coccinelle patches, reviewing the Coccinelle script and a reasonably representative sample of its output is almost certainly a better use of reviewer time than attempting to get all the patches reviewed. They are mind-numbingly dull! For what it's worth, we've used this script several times before. Last in commit bdd81addf4.