Whamcloud - gitweb
LU-9679 all: prefer sizeof(*var) for ALLOC/FREE
The construct
LIBCFS_ALLOC(var, sizeof(*var));
is more obviously correct than
LIBCFS_ALLOC(var, sizeof(struct something));
and is preferred upstream (where it is actually kzalloc
or similar of course).
When it is that simple, and there is no multiplier for
the size,
CFS_ALLOC_PTR(var);
is even better.
The same logic applies to OBD_ALLOC(), LIBCFS_FREE(),
and OBD_FREE().
So convert allocations and frees that use sizeof(struct..)
to use one of the simpler constructs.
In mgs_write_log_mdt0, uuid is better declared as a
"struct obd_uuid *" which is a struct that contain a 'char'
array.
Test-Parameters: trivial
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I8cd97c75241bbb87d15cc6b7c9ac2a7d6184d700
Reviewed-on: https://review.whamcloud.com/36661
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
14 files changed: