From 917a07e1ab2758e3f66a3af455f8d89b8496b394 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 2 Sep 2012 14:46:18 +0000 Subject: [PATCH] Partially revert r239959, after actually fixing most of the clang warnings in sys/gnu/fs/xfs. The only warnings that still need to be suppressed are those about array bound overruns of flexible array members in xfs_dir2_{block,sf}.c, which are too expensive (in terms of cascading code changes) to fix. MFC after: 1 week X-MFC-With: r239959 --- sys/conf/files | 12 ++++++------ sys/gnu/fs/xfs/FreeBSD/xfs_ioctl.c | 4 ---- sys/gnu/fs/xfs/FreeBSD/xfs_stats.c | 2 +- sys/gnu/fs/xfs/FreeBSD/xfs_super.c | 2 +- sys/gnu/fs/xfs/xfs_alloc.c | 4 +++- sys/gnu/fs/xfs/xfs_vfsops.c | 2 +- sys/modules/xfs/Makefile | 6 ------ 7 files changed, 12 insertions(+), 20 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 48e8af215816..08730fb064e7 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -3608,7 +3608,7 @@ xdr/xdr_reference.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | xdr/xdr_sizeof.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd # gnu/fs/xfs/xfs_alloc.c optional xfs \ - compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" \ + compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" \ warning "kernel contains GPL contaminated xfs filesystem" gnu/fs/xfs/xfs_alloc_btree.c optional xfs \ compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" @@ -3627,7 +3627,7 @@ gnu/fs/xfs/xfs_da_btree.c optional xfs \ gnu/fs/xfs/xfs_dir.c optional xfs \ compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" gnu/fs/xfs/xfs_dir2.c optional xfs \ - compile-with "${NORMAL_C} ${NO_WARRAY_BOUNDS} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" + compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" gnu/fs/xfs/xfs_dir2_block.c optional xfs \ compile-with "${NORMAL_C} ${NO_WARRAY_BOUNDS} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" gnu/fs/xfs/xfs_dir2_data.c optional xfs \ @@ -3685,7 +3685,7 @@ gnu/fs/xfs/xfs_trans_item.c optional xfs \ gnu/fs/xfs/xfs_utils.c optional xfs \ compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" gnu/fs/xfs/xfs_vfsops.c optional xfs \ - compile-with "${NORMAL_C} ${NO_WFORMAT_SECURITY} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" + compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" gnu/fs/xfs/xfs_vnodeops.c optional xfs \ compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" gnu/fs/xfs/xfs_rw.c optional xfs \ @@ -3715,9 +3715,9 @@ gnu/fs/xfs/FreeBSD/xfs_globals.c optional xfs \ gnu/fs/xfs/FreeBSD/xfs_dmistubs.c optional xfs \ compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" gnu/fs/xfs/FreeBSD/xfs_super.c optional xfs \ - compile-with "${NORMAL_C} ${NO_WFORMAT_SECURITY} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" + compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" gnu/fs/xfs/FreeBSD/xfs_stats.c optional xfs \ - compile-with "${NORMAL_C} ${NO_WFORMAT_SECURITY} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" + compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" gnu/fs/xfs/FreeBSD/xfs_vfs.c optional xfs \ compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" gnu/fs/xfs/FreeBSD/xfs_vnode.c optional xfs \ @@ -3727,7 +3727,7 @@ gnu/fs/xfs/FreeBSD/xfs_sysctl.c optional xfs \ gnu/fs/xfs/FreeBSD/xfs_fs_subr.c optional xfs \ compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" gnu/fs/xfs/FreeBSD/xfs_ioctl.c optional xfs \ - compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" + compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" gnu/fs/xfs/FreeBSD/support/debug.c optional xfs \ compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" gnu/fs/xfs/FreeBSD/support/ktrace.c optional xfs \ diff --git a/sys/gnu/fs/xfs/FreeBSD/xfs_ioctl.c b/sys/gnu/fs/xfs/FreeBSD/xfs_ioctl.c index 97c4c72af9ef..ff5582c2d590 100644 --- a/sys/gnu/fs/xfs/FreeBSD/xfs_ioctl.c +++ b/sys/gnu/fs/xfs/FreeBSD/xfs_ioctl.c @@ -1249,7 +1249,6 @@ xfs_ioc_xattr( XFS_AT_NEXTENTS | XFS_AT_PROJID; XVOP_GETATTR(vp, vattr, 0, NULL, error); if (unlikely(error)) { - error = error; break; } @@ -1287,7 +1286,6 @@ xfs_ioc_xattr( if (likely(!error)) __vn_revalidate(vp, vattr); /* update flags */ #endif - error = error; break; } @@ -1296,7 +1294,6 @@ xfs_ioc_xattr( XFS_AT_ANEXTENTS | XFS_AT_PROJID; XVOP_GETATTR(vp, vattr, 0, NULL, error); if (unlikely(error)) { - error = error; break; } @@ -1347,7 +1344,6 @@ xfs_ioc_xattr( if (likely(!error)) __vn_revalidate(vp, vattr); /* update flags */ #endif - error = error; break; } diff --git a/sys/gnu/fs/xfs/FreeBSD/xfs_stats.c b/sys/gnu/fs/xfs/FreeBSD/xfs_stats.c index 04582ee77d1e..40b30568e845 100644 --- a/sys/gnu/fs/xfs/FreeBSD/xfs_stats.c +++ b/sys/gnu/fs/xfs/FreeBSD/xfs_stats.c @@ -65,7 +65,7 @@ xfs_read_xfsstats( }; for (i=j=len = 0; i < sizeof(xstats)/sizeof(struct xstats_entry); i++) { - len += sprintf(buffer + len, xstats[i].desc); + len += sprintf(buffer + len, "%s", xstats[i].desc); /* inner loop does each group */ while (j < xstats[i].endpoint) { len += sprintf(buffer + len, " %u", diff --git a/sys/gnu/fs/xfs/FreeBSD/xfs_super.c b/sys/gnu/fs/xfs/FreeBSD/xfs_super.c index 899a41c0c6f1..747a5dae2620 100644 --- a/sys/gnu/fs/xfs/FreeBSD/xfs_super.c +++ b/sys/gnu/fs/xfs/FreeBSD/xfs_super.c @@ -251,7 +251,7 @@ xfs_blkdev_issue_flush( int init_xfs_fs( void ) { - static char message[] = + static const char message[] = XFS_VERSION_STRING " with " XFS_BUILD_OPTIONS " enabled\n"; printf(message); diff --git a/sys/gnu/fs/xfs/xfs_alloc.c b/sys/gnu/fs/xfs/xfs_alloc.c index 64ee07db0d5e..1c2f50e77319 100644 --- a/sys/gnu/fs/xfs/xfs_alloc.c +++ b/sys/gnu/fs/xfs/xfs_alloc.c @@ -1479,8 +1479,10 @@ xfs_alloc_ag_vextent_small( /* * Can't allocate from the freelist for some reason. */ - else + else { + fbno = NULLAGBLOCK; flen = 0; + } /* * Can't do the allocation, give up. */ diff --git a/sys/gnu/fs/xfs/xfs_vfsops.c b/sys/gnu/fs/xfs/xfs_vfsops.c index e97a36399a0e..b073a8e2a5d3 100644 --- a/sys/gnu/fs/xfs/xfs_vfsops.c +++ b/sys/gnu/fs/xfs/xfs_vfsops.c @@ -1954,7 +1954,7 @@ xfs_showargs( for (xfs_infop = xfs_info; xfs_infop->flag; xfs_infop++) { if (mp->m_flags & xfs_infop->flag) - sbuf_printf(m, xfs_infop->str); + sbuf_printf(m, "%s", xfs_infop->str); } if (mp->m_flags & XFS_MOUNT_IHASHSIZE) diff --git a/sys/modules/xfs/Makefile b/sys/modules/xfs/Makefile index c92d05f7d83e..1aabcef51e79 100644 --- a/sys/modules/xfs/Makefile +++ b/sys/modules/xfs/Makefile @@ -84,12 +84,6 @@ CFLAGS+= -I${.CURDIR}/../../gnu/fs/xfs/FreeBSD \ -I${.CURDIR}/../../gnu/fs/xfs/FreeBSD/support \ -I${.CURDIR}/../../gnu/fs/xfs -CWARNFLAGS.xfs_alloc.c= ${NO_WSOMETIMES_UNINITIALIZED} -CWARNFLAGS.xfs_dir2.c= ${NO_WARRAY_BOUNDS} CWARNFLAGS.xfs_dir2_block.c= ${NO_WARRAY_BOUNDS} CWARNFLAGS.xfs_dir2_sf.c= ${NO_WARRAY_BOUNDS} -CWARNFLAGS.xfs_ioctl.c= ${NO_WSELF_ASSIGN} -CWARNFLAGS.xfs_stats.c= ${NO_WFORMAT_SECURITY} -CWARNFLAGS.xfs_super.c= ${NO_WFORMAT_SECURITY} -CWARNFLAGS.xfs_vfsops.c= ${NO_WFORMAT_SECURITY} CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}}