Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758666Ab2FZQa5 (ORCPT ); Tue, 26 Jun 2012 12:30:57 -0400 Received: from perches-mx.perches.com ([206.117.179.246]:40689 "EHLO labridge.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1758499Ab2FZQa4 (ORCPT ); Tue, 26 Jun 2012 12:30:56 -0400 Message-ID: <1340728255.3359.42.camel@joe2Laptop> Subject: Re: [PATCH v3] printk: Have printk() never buffer its data From: Joe Perches To: Kay Sievers Cc: Linus Torvalds , Greg Kroah-Hartman , Andrew Morton , Steven Rostedt , LKML , Ingo Molnar , Wu Fengguang , "Paul E. McKenney" Date: Tue, 26 Jun 2012 09:30:55 -0700 In-Reply-To: <1340726856.977.6.camel@mop> References: <1340651142.7037.2.camel@gandalf.stny.rr.com> <20120625150722.8cd4f45d.akpm@linux-foundation.org> <20120625235531.GB3652@kroah.com> <20120626002307.GA4389@kroah.com> <1340726856.977.6.camel@mop> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.2- Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1192 Lines: 42 On Tue, 2012-06-26 at 18:07 +0200, Kay Sievers wrote: [] Just a couple trivial notes: > diff --git a/kernel/printk.c b/kernel/printk.c [] > @@ -1795,6 +1831,7 @@ static u32 console_idx; > */ > void console_unlock(void) > { > + static char text[LOG_LINE_MAX]; Is this static to avoid excessive stack? Might be useful to note that. > static u64 seen_seq; > unsigned long flags; > bool wake_klogd = false; > @@ -1807,10 +1844,37 @@ void console_unlock(void) > > console_may_schedule = 0; > > + /* flush buffered message fragment immediately to console */ > + raw_spin_lock_irqsave(&logbuf_lock, flags); > + if (cont_cons_len && (cont_cons < cont_cons_len || !cont_len)) { > + size_t textlen = 0; > + size_t len; > + > + len = cont_cons_len - cont_cons; > + if (!cont_cons) > + textlen = print_time(cont_ts_nsec, text); > + memcpy(text + textlen, cont_buf + cont_cons, len); This could overrun the 512 bytes of text yes? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/