From: Oliver Neukum <oliver@neukum.org>
To: greg@kroah.com
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Brian Merrell <bgmerrell@novell.com>,
Takahiro Hirofuchi <hirofuchi@users.sourceforge.net>,
gregkh@suse.de
Subject: Re: [patch 01/03] USB: USB/IP: add common functions needed
Date: Fri, 29 Aug 2008 09:29:51 +0200 [thread overview]
Message-ID: <200808290929.52547.oliver@neukum.org> (raw)
In-Reply-To: <20080828230031.GB15014@kroah.com>
Am Freitag 29 August 2008 01:00:31 schrieb greg@kroah.com:
> From: Takahiro Hirofuchi <hirofuchi@users.sourceforge.net>
> +static ssize_t store_flag(struct device *dev, struct device_attribute *attr,
> + const char *buf, size_t count)
> +{
> + unsigned long flag;
> +
> + sscanf(buf, "%lx", &flag);
Needs error handling
> + usbip_debug_flag = flag;
> +
> + return count;
> +}
> +DEVICE_ATTR(usbip_debug, (S_IRUGO | S_IWUSR), show_flag, store_flag);
> +
> +static void usbip_dump_buffer(char *buff, int bufflen)
Such functions better print into a buffer, handed over in one go.
Otherwise you can get results
-second message-
like this
> +/* there may be more cases to tweak the flags. */
> +static unsigned int tweak_transfer_flags(unsigned int flags)
> +{
> +
> + if (flags & URB_NO_TRANSFER_DMA_MAP)
> + /*
> + * vhci_hcd does not provide DMA-mapped I/O. The upper
> + * driver does not need to set this flag. The remote
> + * usbip.ko does not still perform DMA-mapped I/O for
> + * DMA-caplable host controllers. So, clear this flag.
> + */
> + flags &= ~URB_NO_TRANSFER_DMA_MAP;
> +
> + if (flags & URB_NO_SETUP_DMA_MAP)
> + flags &= ~URB_NO_SETUP_DMA_MAP;
There's no need to do this conditionally.
> +/* must free buffer */
> +void *usbip_alloc_iso_desc_pdu(struct urb *urb, ssize_t *bufflen)
> +{
> + void *buff;
> + struct usbip_iso_packet_descriptor *iso;
> + int np = urb->number_of_packets;
> + ssize_t size = np * sizeof(*iso);
> + int i;
> +
> + buff = kzalloc(size, GFP_KERNEL);
Are you sure you cannot badly recourse here?
Regards
Oliver
next prev parent reply other threads:[~2008-08-29 7:28 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20080828225248.758800945@mini.kroah.org>
2008-08-28 23:00 ` [patch 00/03] USB-IP patches greg
2008-08-28 23:00 ` [patch 01/03] USB: USB/IP: add common functions needed greg
2008-08-29 7:29 ` Oliver Neukum [this message]
2008-08-29 7:52 ` Alexander E. Patrakov
2008-08-29 14:32 ` Greg KH
2008-08-30 0:14 ` Andrew Morton
2008-08-28 23:00 ` [patch 02/03] USB: USB/IP: add client driver greg
2008-08-29 8:23 ` Oliver Neukum
2008-08-29 16:02 ` Alan Stern
2008-08-28 23:00 ` [patch 03/03] USB: USB/IP: add host driver greg
2008-08-29 5:43 ` Willy Tarreau
2008-08-28 23:06 ` [patch 00/03] USB-IP patches Arnaldo Carvalho de Melo
2008-08-30 5:50 ` Brian G. Merrell
2008-09-02 17:12 ` Greg KH
2008-09-24 1:28 ` Brian G. Merrell
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=200808290929.52547.oliver@neukum.org \
--to=oliver@neukum.org \
--cc=bgmerrell@novell.com \
--cc=greg@kroah.com \
--cc=gregkh@suse.de \
--cc=hirofuchi@users.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@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