From 959b14193d96ba91c14036a89881fcc01ee57f12 Mon Sep 17 00:00:00 2001 From: John Marino Date: Tue, 10 Feb 2015 21:57:32 +0100 Subject: [PATCH] newfs_hammer(8): fix [-Wsizeof-pointer-memaccess] The device type comparison only worked by accident on x86-64 and not reliability on i386 because the sizeof function returned the size of the address rather than the size of the vol->type string. Fix by specifying the size of "DEVICE" to strncmp instead. --- sbin/newfs_hammer/newfs_hammer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/newfs_hammer/newfs_hammer.c b/sbin/newfs_hammer/newfs_hammer.c index 80cb51b32c..f0a3920f43 100644 --- a/sbin/newfs_hammer/newfs_hammer.c +++ b/sbin/newfs_hammer/newfs_hammer.c @@ -425,7 +425,7 @@ static void trim_volume(struct volume_info *vol) { - if (strncmp(vol->type, "DEVICE", sizeof(vol->type)) == 0) { + if (strncmp(vol->type, "DEVICE", sizeof("DEVICE")) == 0) { off_t ioarg[2]; /* 1MB offset to prevent destroying disk-reserved area */ -- 2.41.0