From: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>,
Oren Laadan <orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
Cc: containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org,
Dave Hansen
<dave-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Subject: Re: [PATCH/RFC] objhash.c: fix (?) invalid casts
Date: Thu, 15 Jan 2009 16:02:27 -0600 [thread overview]
Message-ID: <20090115220227.GA23557@us.ibm.com> (raw)
In-Reply-To: <20090115194049.GB4924@localdomain>
Quoting Nathan Lynch (ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org):
> When building 64-bit powerpc:
>
> checkpoint/objhash.c: In function 'cr_obj_find_by_objref':
> checkpoint/objhash.c:121: warning: cast to pointer from integer of different size
> checkpoint/objhash.c: In function 'cr_obj_new':
> checkpoint/objhash.c:158: warning: cast to pointer from integer of different size
>
> Is this the right fix or is struct cr_objref->objref the wrong type?
Yeah, Dave suggested on irc changing objref to an unsigned long,
and in fact switching to hash_long(). Oren, what do you think?
Meanwhile, obviously, when I tested the s390 c/r patch it was on top of
these two patches. Worked beautifuly, thanks.
-serge
> ---
> checkpoint/objhash.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> This is on top of v12 of the C/R patches.
>
> diff --git a/checkpoint/objhash.c b/checkpoint/objhash.c
> index 13d3e5d..cb08d3c 100644
> --- a/checkpoint/objhash.c
> +++ b/checkpoint/objhash.c
> @@ -118,7 +118,8 @@ static struct cr_objref *cr_obj_find_by_objref(struct cr_ctx *ctx, int objref)
> struct hlist_node *n;
> struct cr_objref *obj;
>
> - h = &ctx->objhash->head[hash_ptr((void *) objref, CR_OBJHASH_NBITS)];
> + h = &ctx->objhash->head[hash_ptr((void *)(unsigned long)objref,
> + CR_OBJHASH_NBITS)];
> hlist_for_each_entry(obj, n, h, hash)
> if (obj->objref == objref)
> return obj;
> @@ -155,7 +156,7 @@ static struct cr_objref *cr_obj_new(struct cr_ctx *ctx, void *ptr, int objref,
> if (objref) {
> /* use @objref to index (restart) */
> obj->objref = objref;
> - i = hash_ptr((void *) objref, CR_OBJHASH_NBITS);
> + i = hash_ptr((void *)(unsigned long)objref, CR_OBJHASH_NBITS);
> } else {
> /* use @ptr to index, assign objref (checkpoint) */
> obj->objref = ctx->objhash->next_free_objref++;;
> --
> 1.5.5
>
> _______________________________________________
> Containers mailing list
> Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> https://lists.linux-foundation.org/mailman/listinfo/containers
prev parent reply other threads:[~2009-01-15 22:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-15 19:40 [PATCH/RFC] objhash.c: fix (?) invalid casts Nathan Lynch
2009-01-15 22:02 ` Serge E. Hallyn [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090115220227.GA23557@us.ibm.com \
--to=serue-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
--cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
--cc=dave-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
--cc=ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org \
--cc=orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox