hc
2024-09-20 cf4ce59b3b70238352c7f1729f0f7223214828ad
kernel/fs/ocfs2/slot_map.c
....@@ -1,26 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /* -*- mode: c; c-basic-offset: 8; -*-
23 * vim: noexpandtab sw=8 ts=8 sts=0:
34 *
45 * slot_map.c
56 *
6
- *
7
- *
87 * Copyright (C) 2002, 2004 Oracle. All rights reserved.
9
- *
10
- * This program is free software; you can redistribute it and/or
11
- * modify it under the terms of the GNU General Public
12
- * License as published by the Free Software Foundation; either
13
- * version 2 of the License, or (at your option) any later version.
14
- *
15
- * This program is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
- * General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU General Public
21
- * License along with this program; if not, write to the
22
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23
- * Boston, MA 021110-1307, USA.
248 */
259
2610 #include <linux/types.h>
....@@ -55,7 +39,7 @@
5539 unsigned int si_blocks;
5640 struct buffer_head **si_bh;
5741 unsigned int si_num_slots;
58
- struct ocfs2_slot *si_slots;
42
+ struct ocfs2_slot si_slots[];
5943 };
6044
6145
....@@ -420,9 +404,7 @@
420404 struct inode *inode = NULL;
421405 struct ocfs2_slot_info *si;
422406
423
- si = kzalloc(sizeof(struct ocfs2_slot_info) +
424
- (sizeof(struct ocfs2_slot) * osb->max_slots),
425
- GFP_KERNEL);
407
+ si = kzalloc(struct_size(si, si_slots, osb->max_slots), GFP_KERNEL);
426408 if (!si) {
427409 status = -ENOMEM;
428410 mlog_errno(status);
....@@ -431,8 +413,6 @@
431413
432414 si->si_extended = ocfs2_uses_extended_slot_map(osb);
433415 si->si_num_slots = osb->max_slots;
434
- si->si_slots = (struct ocfs2_slot *)((char *)si +
435
- sizeof(struct ocfs2_slot_info));
436416
437417 inode = ocfs2_get_system_file_inode(osb, SLOT_MAP_SYSTEM_INODE,
438418 OCFS2_INVALID_SLOT);