[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <151699903485.21956.15795523878472133751@takondra-t460s>
Date: Fri, 26 Jan 2018 12:37:14 -0800
From: Taras Kondratiuk <takondra@...co.com>
To: "H. Peter Anvin" <hpa@...or.com>,
Al Viro <viro@...iv.linux.org.uk>,
Arnd Bergmann <arnd@...db.de>,
James McMechan <james.w.mcmechan@...il.com>,
Jonathan Corbet <corbet@....net>,
Mimi Zohar <zohar@...ux.vnet.ibm.com>,
Rob Landley <rob@...dley.net>
Cc: initramfs@...r.kernel.org, Victor Kamensky <kamensky@...co.com>,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-security-module@...r.kernel.org, xe-linux-external@...co.com
Subject: Re: [PATCH v2 11/15] gen_init_cpio: add newcx format
Quoting Rob Landley (2018-01-25 18:40:25)
> On 01/24/2018 09:27 PM, Taras Kondratiuk wrote:
> > diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c
> > index 7a2a6d85345d..78a47a5bdcb1 100644
> > --- a/usr/gen_init_cpio.c
> > +++ b/usr/gen_init_cpio.c
> > @@ -10,6 +10,7 @@
> > #include <errno.h>
> > #include <ctype.h>
> > #include <limits.h>
> > +#include <assert.h>
>
> You're adding an assert? Really?
>
> > fputs(s, stdout);
> > - offset += 110;
> > + assert((offset & 3) == 0);
> > + offset += cpio_hdr_size;
>
> Why?
Current code assumes that previous file entry in cpio is padded to 4
byte boundary. The assert just captures this assumption. It should be
true unless there is a bug in the code and some padding is missing.
Actually this assert should be a part of the next patch (#12) that
modifies padding code.
Powered by blists - more mailing lists