Re: [PATCH 2/3] 9pfs: Use g_new() & friends where that makes obvious sense

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Christian,

On 14/3/22 17:42, Christian Schoenebeck wrote:
On Montag, 14. März 2022 17:01:07 CET 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...

Except this uncovers a typing error:

     ../hw/9pfs/9p.c:855:13: warning: incompatible pointer types assigning to
'QpfEntry *' from 'QppEntry *' [-Wincompatible-pointer-types] val =
g_new0(QppEntry, 1);
		^ ~~~~~~~~~~~~~~~~~~~
     1 warning generated.

Harmless, because QppEntry is larger than QpfEntry.  Fix to allocate a
QpfEntry instead.

Cc: Greg Kurz <groug@xxxxxxxx>
Cc: Christian Schoenebeck <qemu_oss@xxxxxxxxxxxxx>
Signed-off-by: Markus Armbruster <armbru@xxxxxxxxxx>
---

Reviewed-by: Christian Schoenebeck <qemu_oss@xxxxxxxxxxxxx>

FYI your domain is also quarantined by Google:

ARC-Authentication-Results: i=1; mx.google.com;
       dkim=fail header.i=@crudebyte.com header.s=lizzy header.b=olij9WvS;
spf=softfail (google.com: domain of transitioning qemu_oss@xxxxxxxxxxxxx does not designate 172.105.152.211 as permitted sender) smtp.mailfrom=qemu_oss@xxxxxxxxxxxxx; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=QUARANTINE) header.from=crudebyte.com Received-SPF: softfail (google.com: domain of transitioning qemu_oss@xxxxxxxxxxxxx does not designate 172.105.152.211 as permitted sender) client-ip=172.105.152.211;
Authentication-Results: mx.google.com;
       dkim=fail header.i=@crudebyte.com header.s=lizzy header.b=olij9WvS;
spf=softfail (google.com: domain of transitioning qemu_oss@xxxxxxxxxxxxx does not designate 172.105.152.211 as permitted sender) smtp.mailfrom=qemu_oss@xxxxxxxxxxxxx; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=QUARANTINE) header.from=crudebyte.com
X-Rspamd-Queue-Id: AC61617709E
X-Spamd-Result: default: False [-2.01 / 7.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; DMARC_POLICY_ALLOW(-0.50)[crudebyte.com,quarantine]; MID_RHS_NOT_FQDN(0.50)[]; R_DKIM_ALLOW(-0.20)[crudebyte.com:s=lizzy]; R_SPF_ALLOW(-0.20)[+ip4:91.194.90.13]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_COUNT_ZERO(0.00)[0]; ASN(0.00)[asn:51167, ipnet:91.194.90.0/23, country:DE]; MIME_TRACE(0.00)[0:+]; FREEMAIL_CC(0.00)[redhat.com,linaro.org,gmail.com,vger.kernel.org,irrelevant.dk,adacore.com,anisinha.ca,netbsd.org,microsoft.com,kernel.org,lists.xenproject.org,users.sourceforge.jp,xen.org,huawei.com,reactos.org,amd.com,citrix.com,syrmia.com,ilande.co.uk,intel.com,kaod.org,nongnu.org,ispras.ru,gibson.dropbear.id.au,habkost.net,virtuozzo.com,google.com,amsat.org,tribudubois.net,mvista.com]; FROM_EQ_ENVFROM(0.00)[]; NEURAL_HAM(-0.00)[-0.923]; ARC_NA(0.00)[]; DKIM_TRACE(0.00)[crudebyte.com:+]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_GT_50(0.00)[66]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TAGGED_RCPT(0.00)[]; RCVD_IN_DNSWL_FAIL(0.00)[91.194.90.13:server fail]
X-Rspamd-Server: atlanta189



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux