Re: [PATCH] USB: usbmon: fix bug in mon_buff_area_shrink

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

 



On Wed, 28 Oct 2009 15:29:20 -0400 (EDT), Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:

> ...   But if only part of a
> scatter-gather buffer can be copied then remainder would be smaller
> than length.

Ah yes, that thing.

> For this reason, it would be better to orient this code around what is 
> missing instead of what is kept.  For example:
> 
> -			ep->len_cap = 0;
> -			mon_buff_area_shrink(rp, length);
> +			delta = (ep->len_cap + PKT_ALIGN-1) & ~(PKT_ALIGN-1);
> +			ep->len_cap -= length;
> +			delta -= (ep->len_cap + PKT_ALIGN-1) & ~(PKT_ALIGN-1);
> +			mon_buff_area_shrink(rp, delta);
> 
> How's that?

Looks fine to me.

-- Pete
--
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