From: Greg KH <gregkh@linuxfoundation.org>
To: Tobias Klauser <tklauser@distanz.ch>
Cc: Stephanie Wallick <stephanie.s.wallick@intel.com>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
"Sean O. Stalley" <sean.stalley@intel.com>
Subject: Re: [PATCH 05/10] added media specific (MS) TCP drivers
Date: Tue, 4 Nov 2014 10:02:10 -0800 [thread overview]
Message-ID: <20141104180210.GA3940@kroah.com> (raw)
In-Reply-To: <20141104084833.GF26719@distanz.ch>
On Tue, Nov 04, 2014 at 09:48:33AM +0100, Tobias Klauser wrote:
> On 2014-11-03 at 21:42:52 +0100, Stephanie Wallick <stephanie.s.wallick@intel.com> wrote:
> > This is where we handle media specific packets and transport. The MS driver
> > interfaces with a media agnostic (MA) driver via a series of transfer pairs.
> > Transfer pairs consist of a set of functions to pass MA USB packets back
> > and forth between MA and MS drivers. There is one transfer pair per device
> > endpoint and one transfer pair for control/management traffic. When the MA
> > driver needs to send an MA USB packet, it hands the packet off to the MS
> > layer where the packet is converted into an MS form and sent via TCP over
> > the underlying ethernet or wireless medium. When the MS driver receives a
> > packet, it converts it into an MA USB packet and hands it off the the MA
> > driver for handling.
> >
> > In addition, the MS driver provides an interface to inititate connection events.
> > Because there are no physical MA USB ports in an MA USB host, the host must be
> > notified via software when a device is connected.
> >
> > Lastly, the MS driver contains a number of ioctl functions that are used by a
> > utility to adjust medium-related driver parameters and connect or disconnect the
> > MA USB host and device drivers.
> >
> > Signed-off-by: Sean O. Stalley <sean.stalley@intel.com>
> > Signed-off-by: Stephanie Wallick <stephanie.s.wallick@intel.com>
> > ---
> > drivers/staging/mausb/drivers/mausb_ioctl.c | 373 +++++++++++++++++++
> > drivers/staging/mausb/drivers/mausb_ioctl.h | 99 +++++
> > drivers/staging/mausb/drivers/mausb_msapi.c | 110 ++++++
> > drivers/staging/mausb/drivers/mausb_msapi.h | 232 ++++++++++++
> > drivers/staging/mausb/drivers/mausb_tcp-device.c | 147 ++++++++
> > drivers/staging/mausb/drivers/mausb_tcp-host.c | 144 ++++++++
> > drivers/staging/mausb/drivers/mausb_tcp.c | 446 +++++++++++++++++++++++
> > drivers/staging/mausb/drivers/mausb_tcp.h | 129 +++++++
> > 8 files changed, 1680 insertions(+)
> > create mode 100644 drivers/staging/mausb/drivers/mausb_ioctl.c
> > create mode 100644 drivers/staging/mausb/drivers/mausb_ioctl.h
> > create mode 100644 drivers/staging/mausb/drivers/mausb_msapi.c
> > create mode 100644 drivers/staging/mausb/drivers/mausb_msapi.h
> > create mode 100644 drivers/staging/mausb/drivers/mausb_tcp-device.c
> > create mode 100644 drivers/staging/mausb/drivers/mausb_tcp-host.c
> > create mode 100644 drivers/staging/mausb/drivers/mausb_tcp.c
> > create mode 100644 drivers/staging/mausb/drivers/mausb_tcp.h
> >
> > diff --git a/drivers/staging/mausb/drivers/mausb_ioctl.c b/drivers/staging/mausb/drivers/mausb_ioctl.c
> > new file mode 100644
> > index 0000000..0c6c6bd
> > --- /dev/null
> > +++ b/drivers/staging/mausb/drivers/mausb_ioctl.c
>
> [...]
>
> > +/**
> > + * This function is used to send a message to the user, in other words, the
> > + * calling process. It basically copies the message one byte at a time.
> > + *
> > + * @msg: The message to be sent to the user.
> > + * @buffer: The buffer in which to put the message. This buffer was given to
> > + * us to fill.
> > + */
> > +void to_user(char *msg, long unsigned int buffer)
> > +{
> > + int length = (int)strlen(msg);
> > + int bytes = 0;
> > +
> > + while (length && *msg) {
> > + put_user(*(msg++), (char *)buffer++);
> > + length--;
> > + bytes++;
> > + }
>
> Any reason not to use copy_to_user here? That way, access_ok would only
> need to be executed once for the whole range.
>
> In any case, the return value of put_user/copy_to_user will need to be
> checked.
Never use put_user if you can help it, this whole function should go
away, and copy_to_user() should be used at the caller sites instead as
you point out.
thanks,
greg k-h
next prev parent reply other threads:[~2014-11-04 18:02 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <MA USB drivers>
2014-11-03 20:42 ` [PATCH 00/10] MA USB drivers cover letter Stephanie Wallick
2014-11-03 20:42 ` [PATCH 01/10] added media agnostic (MA) USB HCD driver Stephanie Wallick
2014-11-03 21:18 ` Greg KH
2014-11-03 23:47 ` steph
2014-11-03 21:21 ` Greg KH
2014-11-04 0:04 ` steph
2014-11-04 0:13 ` Greg KH
2014-11-04 0:59 ` steph
2014-11-05 20:14 ` sostalle
2014-11-05 22:08 ` Greg KH
2014-11-03 20:42 ` [PATCH 02/10] added media agnostic (MA) USB HCD roothubs Stephanie Wallick
2014-11-03 20:42 ` [PATCH 03/10] added media agnostic (MA) data structures and handling Stephanie Wallick
2014-11-03 20:42 ` [PATCH 04/10] added media agnostic (MA) USB packet handling Stephanie Wallick
2014-11-03 20:42 ` [PATCH 05/10] added media specific (MS) TCP drivers Stephanie Wallick
2014-11-04 8:48 ` Tobias Klauser
2014-11-04 18:02 ` Greg KH [this message]
2014-11-12 19:36 ` Sean O. Stalley
2014-11-03 20:42 ` [PATCH 06/10] added media agnostic (MA) UDC Stephanie Wallick
2014-11-03 20:42 ` [PATCH 07/10] added media agnostic (MA) USB management packet handling Stephanie Wallick
2014-11-03 20:42 ` [PATCH 08/10] added media agnostic (MA) USB data " Stephanie Wallick
2014-11-03 20:42 ` [PATCH 09/10] added tools for building/loading media agnostic (MA) USB drivers Stephanie Wallick
2014-11-03 20:42 ` [PATCH 10/10] added kernel build, configuration, and TODO files Stephanie Wallick
2014-11-03 21:22 ` Greg KH
2014-11-03 21:24 ` Greg KH
[not found] ` <54591319.c3b5440a.7374.5f85SMTPIN_ADDED_BROKEN@mx.google.com>
2014-11-04 18:02 ` Greg KH
2014-11-04 9:00 ` [PATCH 00/10] MA USB drivers cover letter Bjørn Mork
2014-11-05 1:31 ` sostalle
2014-11-11 2:09 ` [V2 PATCH 01/10] added media agnostic (MA) USB HCD driver Stephanie Wallick
2014-11-11 2:09 ` [V2 PATCH 02/10] added media agnostic (MA) USB HCD roothubs Stephanie Wallick
2014-11-12 8:35 ` Oliver Neukum
2014-11-12 19:28 ` Sean O. Stalley
2014-11-12 19:52 ` Alan Stern
2014-11-11 2:09 ` [V2 PATCH 03/10] added media agnostic (MA) data structures and handling Stephanie Wallick
2014-11-11 4:38 ` Greg KH
2014-11-11 22:42 ` Sean O. Stalley
2014-11-12 1:14 ` Greg KH
2014-11-12 2:01 ` steph
2014-11-11 2:09 ` [V2 PATCH 04/10] added media agnostic (MA) USB packet handling Stephanie Wallick
2014-11-12 14:01 ` Oliver Neukum
2014-11-11 2:09 ` [V2 PATCH 05/10] added media specific (MS) TCP drivers Stephanie Wallick
2014-11-11 4:21 ` Greg KH
2014-11-11 2:09 ` [V2 PATCH 06/10] added media agnostic (MA) UDC Stephanie Wallick
2014-11-11 2:09 ` [V2 PATCH 07/10] added media agnostic (MA) USB management packet handling Stephanie Wallick
2014-11-11 2:09 ` [V2 PATCH 08/10] added media agnostic (MA) USB data " Stephanie Wallick
2014-11-11 2:09 ` [V2 PATCH 09/10] added tools for building/loading media agnostic (MA) USB drivers Stephanie Wallick
2014-11-11 2:09 ` [V2 PATCH 10/10] added kernel build, configuration, and TODO files Stephanie Wallick
2014-11-11 4:23 ` Greg KH
2014-11-11 4:08 ` [V2 PATCH 01/10] added media agnostic (MA) USB HCD driver Greg KH
2014-11-11 15:54 ` Alan Stern
2014-11-12 21:40 ` Sean O. Stalley
2014-11-12 22:03 ` Alan Stern
2014-11-14 22:48 ` Sean O. Stalley
2014-11-15 21:29 ` Alan Stern
2014-11-12 22:58 ` Sean O. Stalley
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=20141104180210.GA3940@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=devel@driverdev.osuosl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sean.stalley@intel.com \
--cc=stephanie.s.wallick@intel.com \
--cc=tklauser@distanz.ch \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.