Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit da1650a5 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Nathan Scott
Browse files

[XFS] Add format checking to cmn_err and icmn_err



SGI-PV: 942243
SGI-Modid: xfs-linux:xfs-kern:198658a

Signed-off-by: default avatarChristoph Hellwig <hch@sgi.com>
Signed-off-by: default avatarNathan Scott <nathans@sgi.com>
parent 88741a95
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -41,9 +41,10 @@
#define CE_ALERT        1               /* alert        */
#define CE_ALERT        1               /* alert        */
#define CE_PANIC        0               /* panic        */
#define CE_PANIC        0               /* panic        */


extern void icmn_err(int, char *, va_list);
extern void icmn_err(int, char *, va_list)
/* PRINTFLIKE2 */
	__attribute__ ((format (printf, 2, 0)));
extern void cmn_err(int, char *, ...);
extern void cmn_err(int, char *, ...)
	__attribute__ ((format (printf, 2, 3)));


#ifndef STATIC
#ifndef STATIC
# define STATIC static
# define STATIC static
+1 −1
Original line number Original line Diff line number Diff line
@@ -6131,7 +6131,7 @@ xfs_bmap_check_leaf_extents(
		xfs_trans_brelse(NULL, bp);
		xfs_trans_brelse(NULL, bp);
error_norelse:
error_norelse:
	cmn_err(CE_WARN, "%s: BAD after btree leaves for %d extents",
	cmn_err(CE_WARN, "%s: BAD after btree leaves for %d extents",
		i, __FUNCTION__);
		__FUNCTION__, i);
	panic("%s: CORRUPTED BTREE OR SOMETHING", __FUNCTION__);
	panic("%s: CORRUPTED BTREE OR SOMETHING", __FUNCTION__);
	return;
	return;
}
}
+5 −2
Original line number Original line Diff line number Diff line
@@ -957,8 +957,11 @@ xfs_difree(
	agino = XFS_INO_TO_AGINO(mp, inode);
	agino = XFS_INO_TO_AGINO(mp, inode);
	if (inode != XFS_AGINO_TO_INO(mp, agno, agino))  {
	if (inode != XFS_AGINO_TO_INO(mp, agno, agino))  {
		cmn_err(CE_WARN,
		cmn_err(CE_WARN,
			"xfs_difree: inode != XFS_AGINO_TO_INO() (%d != %d) on %s.  Returning EINVAL.",
			"xfs_difree: inode != XFS_AGINO_TO_INO() "
			inode, XFS_AGINO_TO_INO(mp, agno, agino), mp->m_fsname);
			"(%llu != %llu) on %s.  Returning EINVAL.",
			(unsigned long long)inode,
			(unsigned long long)XFS_AGINO_TO_INO(mp, agno, agino),
			mp->m_fsname);
		ASSERT(0);
		ASSERT(0);
		return XFS_ERROR(EINVAL);
		return XFS_ERROR(EINVAL);
	}
	}
+3 −2
Original line number Original line Diff line number Diff line
@@ -194,9 +194,10 @@ xfs_inotobp(
	if ((imap.im_blkno + imap.im_len) >
	if ((imap.im_blkno + imap.im_len) >
	    XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks)) {
	    XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks)) {
		cmn_err(CE_WARN,
		cmn_err(CE_WARN,
	"xfs_inotobp: inode number (%d + %d) maps to a block outside the bounds "
	"xfs_inotobp: inode number (%llu + %d) maps to a block outside the bounds "
	"of the file system %s.  Returning EINVAL.",
	"of the file system %s.  Returning EINVAL.",
			imap.im_blkno, imap.im_len,mp->m_fsname);
			(unsigned long long)imap.im_blkno,
			imap.im_len, mp->m_fsname);
		return XFS_ERROR(EINVAL);
		return XFS_ERROR(EINVAL);
	}
	}


+3 −1
Original line number Original line Diff line number Diff line
@@ -3533,7 +3533,9 @@ xlog_verify_iclog(xlog_t *log,
			}
			}
		}
		}
		if (clientid != XFS_TRANSACTION && clientid != XFS_LOG)
		if (clientid != XFS_TRANSACTION && clientid != XFS_LOG)
			cmn_err(CE_WARN, "xlog_verify_iclog: invalid clientid %d op 0x%p offset 0x%x", clientid, ophead, field_offset);
			cmn_err(CE_WARN, "xlog_verify_iclog: "
				"invalid clientid %d op 0x%p offset 0x%lx",
				clientid, ophead, (unsigned long)field_offset);


		/* check length */
		/* check length */
		field_offset = (__psint_t)
		field_offset = (__psint_t)
Loading