Re: test procedure for cdc-wdm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Oliver Neukum <oliver@xxxxxxxxxx> writes:
> On Wednesday 27 February 2013 10:27:32 Bjørn Mork wrote:
>
>> I believe we could drop the reslength field altogether, avoiding this
>> confusion. The field is only use to test for a 0 length read in a
>> context where desc->length is known to be 0.  In fact, we are really
>> interested in the total desc->length anyway.  The length of the last
>> read is completely irrelevant.
>> 
>> If we don't drop it, then I believe you should set it to 0 on overflow.
>
> But we want user space to read and notice the error condition.

It's unlikely, but if we overflow while waiting for data in wdm_read
then wdm_read will return success unless we set desc->reslength to 0.
The next read will return the error, so it probably does not matter
much.

But as I said, I believe the reslength field is meaningless.  Testing
for it is wrong in the only place where it is ever tested.  We are
really interested in knowing whether there are any data in the buffer,
not how much of it was returned by the last read.

And looking at this I also notice the desc->read field.  We seem to set
it to 0 in wdm_read, but that is the only time it is ever accessed.
So it should also be dropped.



Bjørn

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux