Dear Mariusz, dear Krzysztof, On 13.08.19 11:55, Mariusz Dabrowski wrote: > From: Krzysztof Smolinski <krzysztof.smolinski@xxxxxxxxx> I’d use imperative mood in the commit message, and be more explicit. > mdadm: Use PATH_MAX over MAX_SYSFS_PATH_LEN > GCC8 make more strict checks of possible truncation during snprintf s/make/makes/ or: GCC 8 checks possible truncation during snprintf more strictly than GCC 7. > calls than GCC7 which cause compilation errors. This patch > fixes compilation of mdadm on GCC8 compiler. So you increase the buffer size from 120 to PATH_MAX (4096)? What is the logic behind that besides just being bigger? PATH_MAX seems to be tricky: https://eklitzke.org/path-max-is-tricky > Signed-off-by: Krzysztof Smolinski <krzysztof.smolinski@xxxxxxxxx> > --- > sysfs.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/sysfs.c b/sysfs.c > index c3137818..2bf9793d 100644 > --- a/sysfs.c > +++ b/sysfs.c > @@ -1019,7 +1019,7 @@ int sysfs_rules_apply_check(const struct mdinfo *sra, > /* Check whether parameter is regular file, > * exists and is under specified directory. > */ > - char fname[MAX_SYSFS_PATH_LEN]; > + char fname[PATH_MAX]; > char dname[MAX_SYSFS_PATH_LEN]; > char resolved_path[PATH_MAX]; > char resolved_dir[PATH_MAX]; > @@ -1028,7 +1028,7 @@ int sysfs_rules_apply_check(const struct mdinfo *sra, > return -1; > > snprintf(dname, MAX_SYSFS_PATH_LEN, "/sys/block/%s/md/", sra->sys_name); > - snprintf(fname, MAX_SYSFS_PATH_LEN, "%s/%s", dname, ent->name); > + snprintf(fname, PATH_MAX, "%s/%s", dname, ent->name); > > if (realpath(fname, resolved_path) == NULL || > realpath(dname, resolved_dir) == NULL) Kind regards, Paul
<<attachment: smime.p7s>>