|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH net-next v4] xen-netback: Adding debugfs "io_ring_qX" files
On Mon, Aug 11, 2014 at 11:50:56AM +0100, David Vrabel wrote:
> On 11/08/14 11:38, Wei Liu wrote:
> > On Sun, Aug 10, 2014 at 10:57:51PM +0800, SeeChen Ng wrote:
> >> Hi, I'm a noob to linux kernel, I tried to figure out the usage of the
> >> function
> >> "simple_write_to_buffer", and I got confused about the code here.
> >>
> >>> +static ssize_t
> >>> +xenvif_write_io_ring(struct file *filp, const char __user *buf, size_t
> >>> count,
> >>> + loff_t *ppos)
> >>> +{
> >>> + struct xenvif_queue *queue =
> >>> + ((struct seq_file *)filp->private_data)->private;
> >>> + int len;
> >>> + char write[sizeof(XENVIF_KICK_STR)];
> >>> +
> >>> + /* don't allow partial writes and check the length */
> >>> + if (*ppos != 0)
> >>> + return 0;
> >>> + if (count < sizeof(XENVIF_KICK_STR) - 1)
> >>> + return -ENOSPC;
> >> The statement here is trying to verify the value of "count" is smaller
> >> than the size of array "write", make sure that the array got
> >> enough space for the write operation, right?
> >>
> >
> > Yes I think so.
>
> Is anyone reading the comment?
>
I read that.
> /* don't allow partial writes and check the length */
>
"partial writes" -> ppos check
"check the lenght" -> count check
> The sense of the check is correct.
>
Using -ENOSPC is incorrect for length check IMO.
The following strncmp does the job, if the string written in is not
"kick" it prints out warning.
Wei.
> David
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |