summaryrefslogtreecommitdiffstats
path: root/lib/loopdev.c
diff options
context:
space:
mode:
authorRuediger Meier2017-06-11 23:18:21 +0200
committerKarel Zak2017-06-14 11:48:22 +0200
commitacecab61e575d0729356f1ae2d78642d0c0bccc3 (patch)
treef3bd125031993ebc7cacf7ddad36ea095c22e42a /lib/loopdev.c
parentmisc: fix gcc-7 sprintf warnings -Wformat-overflow (diff)
downloadkernel-qcow2-util-linux-acecab61e575d0729356f1ae2d78642d0c0bccc3.tar.gz
kernel-qcow2-util-linux-acecab61e575d0729356f1ae2d78642d0c0bccc3.tar.xz
kernel-qcow2-util-linux-acecab61e575d0729356f1ae2d78642d0c0bccc3.zip
misc: fix gcc-7 snprintf warnings -Wformat-truncation
../lib/loopdev.c: In function 'loopcxt_next_from_sysfs': ../lib/loopdev.c:545:32: warning: '/loop/backing_file' directive output may be truncated writing 18 bytes into a region of size between 1 and 256 [-Wformat-truncation=] snprintf(name, sizeof(name), "%s/loop/backing_file", d->d_name); ^~~~~~~~~~~~~~~~~~~~~~ ../lib/loopdev.c:545:3: note: 'snprintf' output between 19 and 274 bytes into a destination of size 256 snprintf(name, sizeof(name), "%s/loop/backing_file", d->d_name); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../lib/sysfs.c: In function 'sysfs_is_partition_dirent': ../lib/sysfs.c:343:31: warning: '/start' directive output may be truncated writing 6 bytes into a region of size between 1 and 256 [-Wformat-truncation=] snprintf(path, sizeof(path), "%s/start", d->d_name); ^~~~~~~~~~ ../lib/sysfs.c:343:2: note: 'snprintf' output between 7 and 262 bytes into a destination of size 256 snprintf(path, sizeof(path), "%s/start", d->d_name); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../lib/sysfs.c: In function 'sysfs_partno_to_devno': ../lib/sysfs.c:372:32: warning: '/partition' directive output may be truncated writing 10 bytes into a region of size between 1 and 256 [-Wformat-truncation=] snprintf(path, sizeof(path), "%s/partition", d->d_name); ^~~~~~~~~~~~~~ ../lib/sysfs.c:372:3: note: 'snprintf' output between 11 and 266 bytes into a destination of size 256 snprintf(path, sizeof(path), "%s/partition", d->d_name); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../lib/sysfs.c:377:33: warning: '/dev' directive output may be truncated writing 4 bytes into a region of size between 1 and 256 [-Wformat-truncation=] snprintf(path, sizeof(path), "%s/dev", d->d_name); ^~~~~~~~ ../lib/sysfs.c:377:4: note: 'snprintf' output between 5 and 260 bytes into a destination of size 256 snprintf(path, sizeof(path), "%s/dev", d->d_name); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'lib/loopdev.c')
-rw-r--r--lib/loopdev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/loopdev.c b/lib/loopdev.c
index 00066823c..8c653a361 100644
--- a/lib/loopdev.c
+++ b/lib/loopdev.c
@@ -532,7 +532,7 @@ static int loopcxt_next_from_sysfs(struct loopdev_cxt *lc)
fd = dirfd(iter->sysblock);
while ((d = readdir(iter->sysblock))) {
- char name[256];
+ char name[NAME_MAX + 18 + 1];
struct stat st;
DBG(ITER, ul_debugobj(iter, "check %s", d->d_name));