Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760729Ab2EPWfb (ORCPT ); Wed, 16 May 2012 18:35:31 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:43299 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759748Ab2EPWfQ (ORCPT ); Wed, 16 May 2012 18:35:16 -0400 Date: Wed, 16 May 2012 15:33:46 -0700 From: Anton Vorontsov To: Kees Cook Cc: Greg Kroah-Hartman , Colin Cross , Tony Luck , Arnd Bergmann , John Stultz , Shuah Khan , arve@android.com, Rebecca Schultz Zavin , Jesper Juhl , Randy Dunlap , Stephen Boyd , Thomas Meyer , Andrew Morton , Marco Stornelli , WANG Cong , linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, linaro-kernel@lists.linaro.org, patches@linaro.org, kernel-team@android.com Subject: Re: [PATCH 1/6] pstore: Add console log messages support Message-ID: <20120516223345.GB22797@lizard> References: <20120516125330.GA15460@lizard> <20120516125625.GA20475@lizard> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 882 Lines: 23 On Wed, May 16, 2012 at 09:49:11AM -0700, Kees Cook wrote: [...] > > +#ifdef CONFIG_PSTORE_CONSOLE > > +static void pstore_console_write(struct console *con, const char *s, unsigned c) > > +{ > > +       strncpy(psinfo->buf, s, c); > > The size of psinfo->buf needs to be the length argument to strncpy, > not the size of "s". If "s" isn't NULL terminated, then the min of c > and buf's size should be used. And if this should be NULL terminated > in buf, that needs to be added manually since strncpy won't do it if > it hits the max length argument. Whoops. Will fix it, thanks! -- Anton Vorontsov Email: cbouatmailru@gmail.com -- 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/