sys-utils/zramctl.c: In function ‘zram_get_sysfs’: sys-utils/zramctl.c:220:52: warning: ‘%s’ directive output may be truncated writing up to 4095 bytes into a region of size 27 [-Wformat-truncation=] snprintf(z->devname, sizeof(z->devname), "/dev/%s", name); As an additional good thing zramctl will no longer allocate 4096 bytes from stack when just 23 bytes is enough. Signed-off-by: Sami Kerola <kerolasa@xxxxxx> --- sys-utils/zramctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys-utils/zramctl.c b/sys-utils/zramctl.c index 8da7b2ddb..0dc0947e4 100644 --- a/sys-utils/zramctl.c +++ b/sys-utils/zramctl.c @@ -215,7 +215,7 @@ static struct sysfs_cxt *zram_get_sysfs(struct zram *z) return NULL; if (*z->devname != '/') { /* canonicalize the device name according to /sys */ - char name[PATH_MAX]; + char name[sizeof(z->devname) - sizeof("/dev/")]; if (sysfs_get_devname(&z->sysfs, name, sizeof(name))) snprintf(z->devname, sizeof(z->devname), "/dev/%s", name); } -- 2.17.0 -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html