lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 03 Nov 2014 17:20:18 +0800
From:	Ian Kent <raven@...maw.net>
To:	Joe Perches <joe@...ches.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	linux-fsdevel <linux-fsdevel@...r.kernel.org>,
	autofs mailing list <autofs@...r.kernel.org>,
	Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 04/13] autofs4 - change printks AUTOFS defined prints

On Mon, 2014-11-03 at 00:25 -0800, Joe Perches wrote:
> On Mon, 2014-11-03 at 16:12 +0800, Ian Kent wrote:
> > Use the AUTOFS_*() print defines instead of raw printks.
> 
> Please check the output of these conversions.
> 
> For instance:
> 
> > diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c
> []
> > @@ -162,7 +162,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi,
> >  		break;
> >  	}
> >  	default:
> > -		printk("autofs4_notify_daemon: bad type %d!\n", type);
> > +		AUTOFS_WARN("autofs4_notify_daemon: bad type %d!", type);
> >  		mutex_unlock(&sbi->wq_mutex);
> >  		return;
> >  	}
> 
> The current #define is:
> 
> #define AUTOFS_WARN(fmt, ...)                          \
> 	pr_warn("pid %d: %s: " fmt "\n",        \
> 		current->pid, __func__, ##__VA_ARGS__)
>  
> So this duplicates the function name in the output.

Ahh, yes, I'll fix that.

> 
> It's probably better to simply use
> 	#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> or
> 	#define pr_fmt(fmt) KBUILD_MODNAME ":%d:%s" fmt, current->pid, __func__
> if you _really_ want pid/func in the output

I do, yes.

> 
> and just use pr_<level> instead of AUTOFS_<LEVEL> macros.
> 
> And it's better to use a consistent style for
> these logging functions ideally with terminating
> newlines so there isn't a mix of code with
> and without those newlines.  That inconsistency
> leads to unintended defects.

The idea here was to make the logging consistent throughout.

I have become used of not using the new-line terminator in logging over
the years and tend to favour that myself. You recommend not doing that
probably from a kernel wide consistency perspective? Maybe that is
better ...

Ian

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ