From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
Cc: "Hefty,
Sean" <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
"Smith,
Stan" <stan.smith-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Linux RDMA <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] replace (long*)(long) casting with transportable data type (uintptr_t)
Date: Tue, 30 Nov 2010 12:04:46 -0700 [thread overview]
Message-ID: <20101130190446.GM16788@obsidianresearch.com> (raw)
In-Reply-To: <20101130185754.GY11898@me>
On Tue, Nov 30, 2010 at 08:57:54PM +0200, Sasha Khapyorsky wrote:
> On 10:22 Tue 30 Nov , Hefty, Sean wrote:
> > > Wouldn't it be better to remove those additional castings at all?
> > > Like below?
> > >
> > ..
> > > p_query_req_copy = (osmv_query_req_t *) p_req_madw->context.ni_context.node_guid;
> >
> > I think the Windows compiler will complain about data loss on a 32-bit system.
>
> p_req_madw->context.ni_context.node_guid has 64 bits type.
But the pointer has 32 bits, so the compiler warns you it chucked the
upper 32 bits of node_guid.
The correct cast in C99 is (osmv_query_req_t *)(unitptr_t)
But one should look upon all of these with great suspicion and take a
moment to figure out where the original non-pointer came from. It
better not be from network data or you have a security problem.
Just reading the line from here looks insane, casting a GUID to a
pointer? :)
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-11-30 19:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-09 21:12 [PATCH] replace (long*)(long) casting with transportable data type (uintptr_t) Stan C. Smith
[not found] ` <7C00F472050C412BABCB4F2A59CFBD63-Zpru7NauK7drdx17CPfAsdBPR1lH4CV8@public.gmane.org>
2010-11-30 17:55 ` Sasha Khapyorsky
2010-11-30 18:22 ` Hefty, Sean
[not found] ` <CF9C39F99A89134C9CF9C4CCB68B8DDF25B89244EC-osO9UTpF0USkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2010-11-30 18:57 ` Sasha Khapyorsky
2010-11-30 19:04 ` Jason Gunthorpe [this message]
2010-11-30 19:08 ` Smith, Stan
2010-11-30 18:52 ` Smith, Stan
-- strict thread matches above, loose matches on Subject: below --
2010-12-06 23:55 Stan C. Smith
[not found] ` <3D555CA8351C471B84CD9D6432AFC6D0-Zpru7NauK7drdx17CPfAsdBPR1lH4CV8@public.gmane.org>
2010-12-07 12:43 ` Sasha Khapyorsky
2010-12-07 19:26 ` Hal Rosenstock
[not found] ` <4CFE8A53.6030906-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2010-12-07 23:18 ` Smith, Stan
[not found] ` <3F6F638B8D880340AB536D29CD4C1E1925B9CBC236-osO9UTpF0USkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2010-12-09 16:04 ` Sasha Khapyorsky
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=20101130190446.GM16788@obsidianresearch.com \
--to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org \
--cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=stan.smith-ral2JQCrhuEAvxtiuMwx3w@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