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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F612C433EF for ; Mon, 14 Mar 2022 16:43:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244526AbiCNQoM (ORCPT ); Mon, 14 Mar 2022 12:44:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243795AbiCNQnP (ORCPT ); Mon, 14 Mar 2022 12:43:15 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4959347ACE for ; Mon, 14 Mar 2022 09:41:28 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id rm8-20020a17090b3ec800b001c55791fdb1so7395999pjb.1 for ; Mon, 14 Mar 2022 09:41:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=W0zrBM+N0hxFD4HvfoclDpELnmJr/18GN6q0lPZatEw=; b=fmpUDGOi8OZUJgMmHkU4ZiecIW8QqM1a02qsRb5yuKVzZqkKGRd0gAv5AfPJZciLC2 wyfwXolLcpsITp6G/VgGOl4n+QuCOLQk3Yq16Z7BHeO1D5wgcSAf/IDLm72KrjEXZHV/ M4BRhf0N2E/JnyG/RHuUFZTe+nWC8OwxMU8ozx661gpkTL/UO2ghlDIt48sBGxo0Msdh /YNfia3uEbrZh1oI7H2fo/d1bB9/w6wpunLJALQRD5SqFqrj8TQigLM4Ted+4sWSxOKR FPVMqV/tM1261P8Mf1g7qtmMopnyahbNNaai7t7ssi2iWy+HgxXH9dvrAsqdbHKia6V5 abag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=W0zrBM+N0hxFD4HvfoclDpELnmJr/18GN6q0lPZatEw=; b=0vz37SNy2jacQF2Y2eEeiYoODJE7s4F+gcmqHZmQwuMZQ9AgQiLzogPMZdzcLpuU9f k2t/64SNqnZFXa+Y0vHPUPZjUYvZlgfpQg3HVPT0bkgbIV44UWn+TwelAzJYYWqBtFMv M3x+gfumj0xv6CJjPL7e8PyV0f17Kmen9uRCpBVNaJBTTrg4FT5oMDBIAqrAZAGrtX5h 8VUZHDBy7Ffa2N7Mcf3TIaOSHdR1T+7MBPuqn8OnjaDzSALQwDOzYFRSBY6MxAhfzq4i /Qs2BMNJtj50/iaBZH3hAFMzKW4BzutF+D+nWHw6Zwpn/FU3oJE/H2ioxrszSmgZn9XS /Nag== X-Gm-Message-State: AOAM530sQ/efz12GllIDDHWLeA5SYhU0tCHqp8k32TJV1Q83tEQOi6xX Ew5oJp4LWc79u1CIXaUe0Rc= X-Google-Smtp-Source: ABdhPJwPi5HHkN9qRkorFbCauI5zttPHA5P4ioPiaxV0wCn1Jl6lXBIv9n8vWOh2Ce6Vb5rH2bPC8Q== X-Received: by 2002:a17:90a:1b4a:b0:1bf:1112:5ef with SMTP id q68-20020a17090a1b4a00b001bf111205efmr36323pjq.143.1647276087626; Mon, 14 Mar 2022 09:41:27 -0700 (PDT) Received: from [192.168.1.115] ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id s1-20020a056a00178100b004f731a1a952sm22043486pfg.168.2022.03.14.09.41.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Mar 2022 09:41:27 -0700 (PDT) Message-ID: <8ac83023-3609-4b24-6ffc-9f93478ce69b@gmail.com> Date: Mon, 14 Mar 2022 17:41:09 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH 0/3] Use g_new() & friends where that makes obvious Content-Language: en-US To: Markus Armbruster , qemu-devel@nongnu.org Cc: 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 , Peter Maydell , Stefano Stabellini , Anthony Perard , Paul Durrant , =?UTF-8?Q?Herv=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 , =?UTF-8?Q?Philippe_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 , =?UTF-8?Q?Daniel_P=2e_Berrang=c3=a9?= , Pavel Dovgalyuk , =?UTF-8?Q?Alex_Benn=c3=a9e?= , David Hildenbrand , Wenchao Wang , Colin Xu , 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 References: <20220314160108.1440470-1-armbru@redhat.com> From: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= In-Reply-To: <20220314160108.1440470-1-armbru@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On 14/3/22 17: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 series only touches allocations with size arguments of the form > sizeof(T). It's mechanical, except for a tiny fix in PATCH 2. > > PATCH 1 adds the Coccinelle script. > > PATCH 2 cleans up the virtio-9p subsystem, and fixes a harmless typing > error uncovered by the cleanup. > > PATCH 3 cleans up everything else. I started to split it up, but > splitting is a lot of decisions, and I just can't see the value. > > For instance, MAINTAINERS tells me to split for subsystem "virtio", > patching > > hw/char/virtio-serial-bus.c > hw/display/virtio-gpu.c > hw/net/virtio-net.c > hw/virtio/virtio-crypto.c > hw/virtio/virtio-iommu.c > hw/virtio/virtio.c > > But it also tells me to split for subsystem "Character devices", > patching > > hw/char/parallel.c | 2 +- > hw/char/riscv_htif.c | 2 +- > hw/char/virtio-serial-bus.c | 6 +- > > and for subsystem "Network devices", patching > > hw/net/virtio-net.c > > and for subsystem "virtio-gpu", patching > > hw/display/virtio-gpu.c > > I guess I'd go with "virtio". Six files down, 103 to go. Thanks, but > no thanks. > > Since the transformation is local to a function call, dropping is > completely safe. We can deal with conflicts by dropping conflicting > hunks, with "git-pull -s recursive -X ours". Or drop entire files > with conflicts. > > If you want me to split off certain parts, please tell me exactly what > you want split off, and I'll gladly do the splitting. I don't mind > the splitting part, I do mind the *thinking* part. > > Markus Armbruster (3): > scripts/coccinelle: New use-g_new-etc.cocci > 9pfs: Use g_new() & friends where that makes obvious sense > Use g_new() & friends where that makes obvious sense Series: Reviewed-by: Philippe Mathieu-Daudé