From aec016303bfa65ff5fac679698f3d47eeca3d823 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Wed, 14 Apr 2021 11:15:07 -0400 Subject: [PATCH] super-intel.c: Handle errors from calls to get_dev_sector_size() The compiler gets rather upset if we do not take care of this. Signed-off-by: Jes Sorensen --- super-intel.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/super-intel.c b/super-intel.c index 6617dd6..876e077 100644 --- a/super-intel.c +++ b/super-intel.c @@ -5213,7 +5213,10 @@ static int get_super_block(struct intel_super **super_list, char *devnm, char *d goto error; } - get_dev_sector_size(dfd, NULL, &s->sector_size); + if (!get_dev_sector_size(dfd, NULL, &s->sector_size)) { + err = 2; + goto error; + } find_intel_hba_capability(dfd, s, devname); err = load_and_parse_mpb(dfd, s, NULL, keep_fd); @@ -5292,7 +5295,8 @@ static int load_super_imsm(struct supertype *st, int fd, char *devname) free_super_imsm(st); super = alloc_super(); - get_dev_sector_size(fd, NULL, &super->sector_size); + if (!get_dev_sector_size(fd, NULL, &super->sector_size)) + return 1; if (!super) return 1; /* Load hba and capabilities if they exist. @@ -6001,7 +6005,8 @@ static int add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk, } get_dev_size(fd, NULL, &size); - get_dev_sector_size(fd, NULL, &member_sector_size); + if (!get_dev_sector_size(fd, NULL, &member_sector_size)) + return 1; if (super->sector_size == 0) { /* this a first device, so sector_size is not set yet */ @@ -8882,7 +8887,8 @@ static int store_imsm_mpb(int fd, struct imsm_super *mpb) unsigned long long sectors; unsigned int sector_size; - get_dev_sector_size(fd, NULL, §or_size); + if (!get_dev_sector_size(fd, NULL, §or_size)) + return 1; get_dev_size(fd, NULL, &dsize); if (mpb_size > sector_size) {