summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-28 18:37:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-28 18:37:03 +0000
commiteb8347f2f3d99756b609cac8faa703a048b0faa6 (patch)
tree19148a2a94752407fcd2ec6b94d92d088ff2bef7
parentReleasing debian version 4.2+20230223-2. (diff)
downloadmdadm-eb8347f2f3d99756b609cac8faa703a048b0faa6.tar.xz
mdadm-eb8347f2f3d99756b609cac8faa703a048b0faa6.zip
Merging upstream version 4.2+20230227.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
-rw-r--r--mapfile.c4
-rw-r--r--util.c7
2 files changed, 10 insertions, 1 deletions
diff --git a/mapfile.c b/mapfile.c
index 6b2207d..ac35176 100644
--- a/mapfile.c
+++ b/mapfile.c
@@ -292,6 +292,10 @@ struct map_ent *map_by_uuid(struct map_ent **map, int uuid[4])
struct map_ent *map_by_devnm(struct map_ent **map, char *devnm)
{
struct map_ent *mp;
+
+ if (!devnm)
+ return NULL;
+
if (!*map)
map_read(map);
diff --git a/util.c b/util.c
index 9cd89fa..8c7f3fd 100644
--- a/util.c
+++ b/util.c
@@ -1160,6 +1160,11 @@ struct supertype *super_by_fd(int fd, char **subarrayp)
int i;
char *subarray = NULL;
char container[32] = "";
+ char *devnm = NULL;
+
+ devnm = fd2devnm(fd);
+ if (!devnm)
+ return NULL;
sra = sysfs_read(fd, NULL, GET_VERSION);
@@ -1205,7 +1210,7 @@ struct supertype *super_by_fd(int fd, char **subarrayp)
if (subarrayp)
*subarrayp = subarray;
strcpy(st->container_devnm, container);
- strcpy(st->devnm, fd2devnm(fd));
+ strncpy(st->devnm, devnm, MD_NAME_MAX - 1);
} else
free(subarray);