Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Christophe JAILLET and committed by
Andrew Morton
d70fa34f cb2273a4

+3 -3
+3 -3
fs/ocfs2/journal.c
··· 114 114 if (osb->replay_map) 115 115 return 0; 116 116 117 - replay_map = kzalloc(sizeof(struct ocfs2_replay_map) + 118 - (osb->max_slots * sizeof(char)), GFP_KERNEL); 119 - 117 + replay_map = kzalloc(struct_size(replay_map, rm_replay_slots, 118 + osb->max_slots), 119 + GFP_KERNEL); 120 120 if (!replay_map) { 121 121 mlog_errno(-ENOMEM); 122 122 return -ENOMEM;