[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <adaaars0xy1.fsf@roland-alpha.cisco.com>
Date: Sat, 22 May 2010 08:15:50 -0700
From: Roland Dreier <rdreier@...co.com>
To: wharms@....de
Cc: Julia Lawall <julia@...u.dk>, Roland Dreier <rolandd@...co.com>,
Sean Hefty <sean.hefty@...el.com>,
Hal Rosenstock <hal.rosenstock@...il.com>,
linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 10/27] drivers/infiniband/core: Use memdup_user
> > + data = memdup_user((void __user *)(unsigned long)src, len);
> > + if (IS_ERR(data))
> > + return PTR_ERR(data);
> This cast look strange, can it happen that (unsigned long)<(u64) ?
> (is there a 32bit infiniband) ?
There is 32-bit infiniband. Linux kernel assumes that unsigned long is
equivalent to uintptr_t -- in other words all pointers are the same size
as longs. So when casting from integer to pointer we add a cast to
unsigned long to avoid a warning precisely in the 32-bit case -- we
would get a warning about cast to pointer from integer of different size
when casting from 64-bit integer to 32-bit pointer.
--
Roland Dreier <rolandd@...co.com> || For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/index.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists