Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968082Ab2ERVvM (ORCPT ); Fri, 18 May 2012 17:51:12 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:41040 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757993Ab2ERVvK (ORCPT ); Fri, 18 May 2012 17:51:10 -0400 Date: Fri, 18 May 2012 14:49:39 -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/3] pstore/ram: Switch to persistent_ram routines Message-ID: <20120518214939.GA5412@lizard> References: <20120517071148.GA16946@lizard> <20120517071518.GB19999@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: 1286 Lines: 31 On Thu, May 17, 2012 at 09:34:19AM -0700, Kees Cook wrote: [...] > > -       memcpy(buf, cxt->pstore.buf, size); > > -       memset(buf + size, '\0', available - size); > > +       hlen = ramoops_write_kmsg_hdr(prz); > > +       if (size + hlen > prz->buffer_size) > > +               size = prz->buffer_size - hlen; > > +       persistent_ram_write(prz, cxt->pstore.buf, size); > > This still needs to wipe out the remaining bytes in the buffer (the > second memset above). [...] > > -       buf = cxt->virt_addr + (id * cxt->record_size); > > -       memset(buf, '\0', cxt->record_size); > > +       persistent_ram_free_old(cxt->przs[id]); > > Same here -- erasing the buffer means wiping it with NULL bytes. Well, with persistent_ram we don't need to actually erase buffers (with persistent_ram we might even hold binary data). But yes, we'd better reset size pointer, otherwise the unlinked buffer will show up on the next reboot. Thanks for noticing! -- 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/