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]
Message-ID: <20110218200528.GA4966@elte.hu>
Date:	Fri, 18 Feb 2011 21:05:28 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Joe Perches <joe@...ches.com>
Cc:	mingo@...hat.com, hpa@...or.com, linux-kernel@...r.kernel.org,
	jbeulich@...ell.com, tglx@...utronix.de,
	linux-tip-commits@...r.kernel.org
Subject: Re: [tip:x86/debug] x86: Combine printk()s in show_regs_common()


* Joe Perches <joe@...ches.com> wrote:

> On Fri, 2011-02-18 at 10:40 +0000, tip-bot for Jan Beulich wrote:
> > Commit-ID:  fd8fa4d3ddc4cc04ec8097e632b995d535c52beb
> > Gitweb:     http://git.kernel.org/tip/fd8fa4d3ddc4cc04ec8097e632b995d535c52beb
> > Author:     Jan Beulich <JBeulich@...ell.com>
> > AuthorDate: Thu, 17 Feb 2011 15:56:58 +0000
> > Committer:  Ingo Molnar <mingo@...e.hu>
> > CommitDate: Fri, 18 Feb 2011 08:52:30 +0100
> > 
> > x86: Combine printk()s in show_regs_common()
> > 
> > Printing a single character alone when there's an immediately
> > following printk() is pretty pointless (and wasteful).
> 
> Ingo, why did you choose to apply this patch instead of
> the alternative one I posted on the same thread?

Your version:

	/* Board Name is optional */
	board = dmi_get_system_info(DMI_BOARD_NAME);
	if (!board)
		board = "";

	printk(KERN_CONT "\n");

	printk(KERN_DEFAULT "Pid: %d, comm: %.20s %s %s %.*s %s %s%s%s\n",
	       current->pid, current->comm, print_tainted(),
	       init_utsname()->release,
	       (int)strcspn(init_utsname()->version, " "),
	       init_utsname()->version,
	       vendor, product,
	       strlen(board) ? "/" : "",
	       board);

The 'board' fiddling and the strlen(board) check complicates things unnecessarily 
and makes the code hard to read. Jan's version was at least simple.

Something like this:

	/* Board Name is optional */
	board = dmi_get_system_info(DMI_BOARD_NAME);

	printk(KERN_CONT "\n");

	printk(KERN_DEFAULT "Pid: %d, comm: %.20s %s %s %.*s %s %s %s %s\n",
	       current->pid, current->comm, print_tainted(),
	       init_utsname()->release,
	       (int)strcspn(init_utsname()->version, " "),
	       init_utsname()->version,
	       vendor, product, board ? : "");

Would be easier to read and gives similarly useful output.

Thanks,

	Ingo
--
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