diff options
author | Mateusz Kusiak <mateusz.kusiak@intel.com> | 2024-02-20 11:56:11 +0100 |
---|---|---|
committer | Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> | 2024-02-23 12:44:12 +0100 |
commit | 7ccf947eb595c1bb729c32ba18ce171dada76a68 (patch) | |
tree | a037dcd2bf16c2af2c12a2a3650377ebe5117042 /super1.c | |
parent | Grow: remove dead condition in Grow_reshape() (diff) | |
download | mdadm-7ccf947eb595c1bb729c32ba18ce171dada76a68.tar.xz mdadm-7ccf947eb595c1bb729c32ba18ce171dada76a68.zip |
super1: check fd before passing to get_dev_size() in add_to_super1()
Check if file descriptor is valid before passing it to get_dev_size() in
add_to_super().
Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com>
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Diffstat (limited to 'super1.c')
-rw-r--r-- | super1.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -1752,7 +1752,10 @@ static int add_to_super1(struct supertype *st, mdu_disk_info_t *dk, di->devname = devname; di->disk = *dk; di->data_offset = data_offset; - get_dev_size(fd, NULL, &di->dev_size); + + if (is_fd_valid(fd)) + get_dev_size(fd, NULL, &di->dev_size); + di->next = NULL; *dip = di; |