qemu-e2k/hw/9pfs
Markus Armbruster 1366244ab6 9pfs: Use g_new() & friends where that makes obvious sense
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).

Initial patch created mechanically with:

    $ spatch --in-place --sp-file scripts/coccinelle/use-g_new-etc.cocci \
	     --macro-file scripts/cocci-macro-file.h FILES...

This uncovers a typing error:

    ../hw/9pfs/9p.c: In function ‘qid_path_fullmap’:
    ../hw/9pfs/9p.c:855:13: error: assignment to ‘QpfEntry *’ from incompatible pointer type ‘QppEntry *’ [-Werror=incompatible-pointer-types]
      855 |         val = g_new0(QppEntry, 1);
	  |             ^

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

Cc: Greg Kurz <groug@kaod.org>
Cc: Christian Schoenebeck <qemu_oss@crudebyte.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Greg Kurz <groug@kaod.org>
Message-Id: <20220315144156.1595462-3-armbru@redhat.com>
2022-03-21 15:44:44 +01:00
..
9p-local.c 9p: darwin: Implement compatibility for mknodat 2022-03-07 11:49:31 +01:00
9p-local.h 9pfs: local: open/opendir: don't follow symlinks 2017-02-28 11:21:15 +01:00
9p-posix-acl.c 9pfs: add link to 9p developer docs 2021-07-05 13:03:16 +02:00
9p-proxy.c 9pfs: Use g_new() & friends where that makes obvious sense 2022-03-21 15:44:44 +01:00
9p-proxy.h Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
9p-synth.c 9pfs: Use g_new() & friends where that makes obvious sense 2022-03-21 15:44:44 +01:00
9p-synth.h 9pfs: Fix segfault in do_readdir_many caused by struct dirent overread 2022-02-17 16:57:58 +01:00
9p-util-darwin.c 9p: darwin: Implement compatibility for mknodat 2022-03-07 11:49:31 +01:00
9p-util-linux.c 9p: darwin: Implement compatibility for mknodat 2022-03-07 11:49:31 +01:00
9p-util.h 9pfs/9p-util.h: convert Doxygen -> kerneldoc format 2022-03-07 11:49:31 +01:00
9p-xattr-user.c 9pfs: add link to 9p developer docs 2021-07-05 13:03:16 +02:00
9p-xattr.c 9pfs: add link to 9p developer docs 2021-07-05 13:03:16 +02:00
9p-xattr.h 9pfs: fix XattrOperations typedef 2018-01-08 11:18:22 +01:00
9p.c 9pfs: Use g_new() & friends where that makes obvious sense 2022-03-21 15:44:44 +01:00
9p.h 9pfs/9p.h: convert Doxygen -> kerneldoc format 2022-03-07 11:49:31 +01:00
Kconfig hw/9pfs: Fix Kconfig dependency problem between 9pfs and Xen 2020-11-05 15:21:11 +01:00
codir.c 9pfs: Use g_new() & friends where that makes obvious sense 2022-03-21 15:44:44 +01:00
cofile.c 9pfs: add link to 9p developer docs 2021-07-05 13:03:16 +02:00
cofs.c 9pfs: add link to 9p developer docs 2021-07-05 13:03:16 +02:00
coth.c 9pfs: add link to 9p developer docs 2021-07-05 13:03:16 +02:00
coth.h 9pfs/coth.h: drop Doxygen format on v9fs_co_run_in_worker() 2022-03-07 11:49:31 +01:00
coxattr.c 9pfs: add link to 9p developer docs 2021-07-05 13:03:16 +02:00
meson.build 9p: darwin: *xattr_nofollow implementations 2022-03-07 11:49:31 +01:00
trace-events docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
virtio-9p-device.c 9pfs: add link to 9p developer docs 2021-07-05 13:03:16 +02:00
virtio-9p.h Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
xen-9p-backend.c 9pfs: add link to 9p developer docs 2021-07-05 13:03:16 +02:00
xen-9pfs.h xen: Import other xen/io/*.h 2019-06-24 10:42:30 +01:00