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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 26 Aug 2007 10:36:30 -0700
From:	Joe Perches <joe@...ches.com>
To:	Geert Uytterhoeven <geert@...ux-m68k.org>
Cc:	netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Prefix each line of multiline printk(KERN_<level>
	"foo\nbar") with KERN_<level>

On Sun, 2007-08-26 at 10:30 +0200, Geert Uytterhoeven wrote: 
> On Fri, 24 Aug 2007, Joe Perches wrote:
> > Corrected printk calls with multiple output lines which
> > did not correctly preface each line with KERN_<level>
> > Fixed uses of some single lines with too many KERN_<level>
> > --- a/arch/arm/kernel/ecard.c
> > +++ b/arch/arm/kernel/ecard.c
> > @@ -547,7 +547,8 @@ static void ecard_check_lockup(struct irq_desc *desc)
> >  	if (last == jiffies) {
> >  		lockup += 1;
> >  		if (lockup > 1000000) {
> > -			printk(KERN_ERR "\nInterrupt lockup detected - "
> > +			printk(KERN_ERR "\n"
> > +			       KERN_ERR "Interrupt lockup detected - "
> >  			       "disabling all expansion card interrupts\n");
> >  
> >  			desc->chip->mask(IRQ_EXPANSIONCARD);
> 
> What's the purpose of having lines printed with e.g. `KERN_ERR "\n"' only?
> Shouldn't these just be removed?

My preference too.  There could be a separate effort for that.

egrep -r --include=*.[ch] "KERN_[A-Z]*[[:space:]]+\"\\\n" * | wc -l
104

These are either errors or a desire to prettify logs with
vertical whitespace.  I think vertical whitespace doesn't help.

> Usually lines starting with `\n' are continuations, but given some other
> module may call printk() in between, there's no guarantee continuations
> appear on the same line.

printk KERN_<level>s were sometimes bolted on after code was written.

etherfoo_card_init()
{
	printk(KERN_INFO "etherfoo card");
	slot = foo_getslot();
	if (slot < 0) {
		printk("\n" KERN_ERR "etherfoo card slot not found\n");
		return -1;
	}
	printk(" found in slot %d", slot);
	irq = foo_getirq();
	if (irq < 0) {
		printk("\n" KERN_ERR "etherfoo card irq not found\n");
		return -1;
	}
	printk(" with irq %d\n", irq);
}

Sometimes, a KERN_ERR is misplaced, or the "\n" is missing.

	printk(KERN_ERR "\n" msg);
or
	printk(KERN_ERR msg);

To me, the card announcement printk should move to the
end of the card_init routine and just be a single printk.

etherfoo_card_init()
{
	slot = foo_getslot();
	if (slot < 0) {
		printk(KERN_ERR "etherfoo card slot not found\n");
		return -1;
	}
	irq = foo_getirq();
	if (irq < 0) {
		printk(KERN_ERR "etherfoo card irq not found\n");
		return -1;
	}
	printk(KERN_INFO "etherfoo card in slot %d with irq %d\n",
	       slot, irq);
}


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ