driverdev-devel.linuxdriverproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Abbott <abbotti@mev.co.uk>
To: David Laight <David.Laight@ACULAB.COM>,
	Greg KH <gregkh@linuxfoundation.org>,
	Atul Gopinathan <atulgopinathan@gmail.com>
Cc: "devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] staging: comedi: cast to (unsigned int *)
Date: Fri, 19 Feb 2021 09:31:16 +0000	[thread overview]
Message-ID: <94917044-ba8f-7044-42f6-7e8d5ef1e10b@mev.co.uk> (raw)
In-Reply-To: <21a953261eb44e7ba302cfe74d8efa2d@AcuMS.aculab.com>

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@mev.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 )=-
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

      parent reply	other threads:[~2021-02-19  9:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-17 16:59 [PATCH] staging: comedi: cast to (unsigned int *) Atul Gopinathan
2021-02-17 17:35 ` Greg KH
2021-02-17 18:10   ` Atul Gopinathan
2021-02-17 18:26     ` Greg KH
2021-02-18 11:04       ` Ian Abbott
2021-02-19  9:03         ` David Laight
2021-02-19  9:26           ` Dan Carpenter
2021-02-19  9:36             ` David Laight
2021-02-19  9:31           ` Ian Abbott [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=94917044-ba8f-7044-42f6-7e8d5ef1e10b@mev.co.uk \
    --to=abbotti@mev.co.uk \
    --cc=David.Laight@ACULAB.COM \
    --cc=atulgopinathan@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).