mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-01 10:45:49 +00:00
ocfs2: Use struct_size()
Use struct_size() instead of hand-writing it, when allocating a structure with a flex array. This is less verbose. Link: https://lkml.kernel.org/r/9d99ea2090739f816d0dc0c4ebaa42b26fc48a9e.1689533270.git.christophe.jaillet@wanadoo.fr Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com> Cc: Mark Fasheh <mark@fasheh.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Junxiao Bi <junxiao.bi@oracle.com> Cc: Changwei Ge <gechangwei@live.cn> Cc: Gang He <ghe@suse.com> Cc: Jun Piao <piaojun@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
cb2273a415
commit
d70fa34f99
@ -114,9 +114,9 @@ int ocfs2_compute_replay_slots(struct ocfs2_super *osb)
|
||||
if (osb->replay_map)
|
||||
return 0;
|
||||
|
||||
replay_map = kzalloc(sizeof(struct ocfs2_replay_map) +
|
||||
(osb->max_slots * sizeof(char)), GFP_KERNEL);
|
||||
|
||||
replay_map = kzalloc(struct_size(replay_map, rm_replay_slots,
|
||||
osb->max_slots),
|
||||
GFP_KERNEL);
|
||||
if (!replay_map) {
|
||||
mlog_errno(-ENOMEM);
|
||||
return -ENOMEM;
|
||||
|
Loading…
Reference in New Issue
Block a user