Commit 89e49671 authored by Russell Cattelan's avatar Russell Cattelan Committed by Christoph Hellwig

[XFS] Fix the cmn_err stuff to mask the error level before it checks for max value

SGI Modid: 2.5.x-xfs:slinx:135869a
parent 9cc92e3e
......@@ -42,6 +42,7 @@ static spinlock_t xfs_err_lock = SPIN_LOCK_UNLOCKED;
/* Translate from CE_FOO to KERN_FOO, err_level(CE_FOO) == KERN_FOO */
#define XFS_MAX_ERR_LEVEL 7
#define XFS_ERR_MASK ((1 << 3) - 1)
static char *err_level[XFS_MAX_ERR_LEVEL+1] =
{KERN_EMERG, KERN_ALERT, KERN_CRIT,
KERN_ERR, KERN_WARNING, KERN_NOTICE,
......@@ -84,15 +85,19 @@ void
cmn_err(register int level, char *fmt, ...)
{
char *fp = fmt;
va_list ap;
int len;
va_list ap;
level &= XFS_ERR_MASK;
if (level > XFS_MAX_ERR_LEVEL)
level = XFS_MAX_ERR_LEVEL;
spin_lock(&xfs_err_lock);
va_start(ap, fmt);
if (*fmt == '!') fp++;
vsprintf(message, fp, ap);
printk("%s%s\n", err_level[level], message);
len = vsprintf(message, fp, ap);
if (message[len-1] != '\n')
strcat(message, "\n");
printk("%s%s", err_level[level], message);
va_end(ap);
spin_unlock(&xfs_err_lock);
......@@ -104,12 +109,17 @@ cmn_err(register int level, char *fmt, ...)
void
icmn_err(register int level, char *fmt, va_list ap)
{
if (level > XFS_MAX_ERR_LEVEL)
int len;
level &= XFS_ERR_MASK;
if(level > XFS_MAX_ERR_LEVEL)
level = XFS_MAX_ERR_LEVEL;
spin_lock(&xfs_err_lock);
vsprintf(message, fmt, ap);
len = vsprintf(message, fmt, ap);
if (message[len-1] != '\n')
strcat(message, "\n");
spin_unlock(&xfs_err_lock);
printk("%s%s\n", err_level[level], message);
printk("%s%s", err_level[level], message);
if (level == CE_PANIC)
BUG();
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment