summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKinga Stefaniuk <kinga.stefaniuk@intel.com>2024-08-06 11:14:02 +0200
committerMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>2024-08-06 13:53:54 +0200
commit734de8b02022bf3b7a5f2111f5314a87ddebcc83 (patch)
treef6af0dcfad639cd69f2f95a1f4677bed549c6033
parentsuper-gpt.c: Fix check_return issue in load_gpt() (diff)
downloadmdadm-734de8b02022bf3b7a5f2111f5314a87ddebcc83.tar.xz
mdadm-734de8b02022bf3b7a5f2111f5314a87ddebcc83.zip
super-intel: fix compilation error
Fix compilation error: super-intel.c: In function ‘end_migration’: super-intel.c:4360:29: error: writing 2 bytes into a region of size 0 [-Werror=stringop-overflow=] 4360 | dev->vol.migr_state = 0; | ~~~~~~~~~~~~~~~~~~~~^~~ cc1: note: destination object is likely at address zero cc1: all warnings being treated as errors make: *** [Makefile:232: super-intel.o] Error 1 reported, when GCC 14 is used. Return when dev is NULL, to avoid it. Signed-off-by: Kinga Stefaniuk <kinga.stefaniuk@intel.com>
-rw-r--r--super-intel.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/super-intel.c b/super-intel.c
index ab9b5d3f..f6745e10 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -4330,6 +4330,12 @@ static void migrate(struct imsm_dev *dev, struct intel_super *super,
static void end_migration(struct imsm_dev *dev, struct intel_super *super,
__u8 map_state)
{
+ /* To avoid compilation error, saying dev can't be NULL when
+ * migr_state is assigned.
+ */
+ if (dev == NULL)
+ return;
+
struct imsm_map *map = get_imsm_map(dev, MAP_0);
struct imsm_map *prev = get_imsm_map(dev, dev->vol.migr_state == 0 ?
MAP_0 : MAP_1);