Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760666Ab2EPW3z (ORCPT ); Wed, 16 May 2012 18:29:55 -0400 Received: from mail-pz0-f46.google.com ([209.85.210.46]:36615 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753758Ab2EPW3x (ORCPT ); Wed, 16 May 2012 18:29:53 -0400 Date: Wed, 16 May 2012 15:28:23 -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 2/6] pstore/ram: Add console messages handling Message-ID: <20120516222823.GA22797@lizard> References: <20120516125330.GA15460@lizard> <20120516125634.GB20475@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: 1932 Lines: 49 On Wed, May 16, 2012 at 09:45:35AM -0700, Kees Cook wrote: > On Wed, May 16, 2012 at 5:56 AM, Anton Vorontsov > wrote: > > This is all straightforward: we just use the last region for > > console logging. If there's just one region, we fall-back to > > the old behaviour: just a oops/dumps logging. > > > > Signed-off-by: Anton Vorontsov > > --- > >  fs/pstore/ram.c |   39 ++++++++++++++++++++++++++++++--------- > >  1 file changed, 30 insertions(+), 9 deletions(-) > > > > diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c > > index 9123cce..54213eb 100644 > > --- a/fs/pstore/ram.c > > +++ b/fs/pstore/ram.c > > [...] > > @@ -142,7 +148,12 @@ static int ramoops_pstore_write(enum pstore_type_id type, > >        struct persistent_ram_zone *prz = cxt->przs[cxt->count]; > >        size_t hlen; > > > > -       /* Currently ramoops is designed to only store dmesg dumps. */ > > +       if (type == PSTORE_TYPE_CONSOLE) { > > +               if (!cxt->cprz) > > +                       return -ENOMEM; > > +               persistent_ram_write(cxt->cprz, cxt->pstore.buf, size); > > +       } > > + > >        if (type != PSTORE_TYPE_DMESG) > >                return -EINVAL; > > Doesn't this mean that type == PSTORE_TYPE_CONSOLE will write to the > ram, but then fail with -EINVAL? Right you are, there should be 'return 0' for TYPE_CONSOLE. It is harmless tho (and unnoticeable, since we can't check return value of the ->write() calback and print error, since this would recurse), but I'll surely amend that. 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/