[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <94917044-ba8f-7044-42f6-7e8d5ef1e10b@mev.co.uk>
Date: Fri, 19 Feb 2021 09:31:16 +0000
From: Ian Abbott <abbotti@....co.uk>
To: David Laight <David.Laight@...LAB.COM>,
Greg KH <gregkh@...uxfoundation.org>,
Atul Gopinathan <atulgopinathan@...il.com>
Cc: "devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] staging: comedi: cast to (unsigned int *)
On 19/02/2021 09:03, David Laight wrote:
>> It's kind of moot anyway because the patch is outdated. But the reason
>> for the ___force is that the same `struct comedi_cmd` is used in both
>> user and kernel contexts. In user contexts, the `chanlist` member
>> points to user memory and in kernel contexts it points to kernel memory
>> (copied from userspace).
>
> Can't you use a union of the user and kernel pointers?
> (Possibly even anonymous?)
> Although, ideally, keeping them in separate fields is better.
> 8 bytes for a pointer isn't going make a fat lot of difference.
This is for a UAPI header (eventually), so cannot add a new field. For
an anonymous union, one tagged with __user and one not, the __user tag
would be removed during conversion from UAPI headers to
/usr/include/linux headers, leaving a union of two identically typed
members, which would look a bit odd. The union also kind of hides the
problem.
--
-=( Ian Abbott <abbotti@....co.uk> || MEV Ltd. is a company )=-
-=( registered in England & Wales. Regd. number: 02862268. )=-
-=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
-=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-
Powered by blists - more mailing lists