From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Serge E. Hallyn" Subject: Re: [PATCH 1/1] cr: uts: don't pass an unsigned var as a signed int Date: Sat, 20 Jun 2009 19:18:37 -0500 Message-ID: <20090621001837.GA32394@hallyn.com> References: <20090619203719.GA30093@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Nathan Lynch Cc: Linux Containers List-Id: containers.vger.kernel.org Quoting Nathan Lynch (ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org): > "Serge E. Hallyn" writes: > > > Else my checkpoing image gets reeeaallly huge. Just passing the > > result of sizeof() however does the right thing. > > > > Signed-off-by: Serge E. Hallyn > > --- > > checkpoint/namespace.c | 12 ++++++------ > > 1 files changed, 6 insertions(+), 6 deletions(-) > > But right above the code you're changing we have: > > h->sysname_len = sizeof(name->sysname); > h->nodename_len = sizeof(name->nodename); > h->release_len = sizeof(name->release); > h->version_len = sizeof(name->version); > h->machine_len = sizeof(name->machine); > h->domainname_len = sizeof(name->domainname); > > Your patch shouldn't change any behavior. What gives? "Shouldn't", perhaps, but does. I assumed the compiler guessed that i wanted an int in the second case and gave me a different result for that sizeof. > (PS: ckpt_write_string and friends should take a size_t or some other > unsigned type for len.) There I agree, but then we need to check that no callers are passing in potentially negative signed ints coming from userspace, so I thought this patch would spur discussion about best path forward (plus make checkpoint work for me again :) -serge