Re: [PATCH 1/3] tools: hv: fcopy_daemon: Check buffer limits

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

 



On Tue, 21 Oct 2014 13:49:00 +0200
Matej Mužila <mmuzila@xxxxxxxxxx> wrote:

> From: Matej Mužila <mmuzila@xxxxxxxxxx>
> 
> Check if cpmsg->size is in limits of DATA_FRAGMENT
> 
> Signed-off-by: Matej Mužila <mmuzila@xxxxxxxxxx>
> Acked-by:  K. Y. Srinivasan <kys@xxxxxxxxxxxxx>
> ---
> If corrupted data are read from /dev/vmbus/hv_fcopy, pwrite can
> read from memory outside of the buffer (defined at line 138).
> Added check. 
> ---
> @@ -104,6 +104,10 @@ static int hv_copy_data(struct hv_do_fcopy *cpmsg)
>  {
>  	ssize_t bytes_written;
>  
> +	// Check if the cpmsg->size is in limits of DATA_FRAGMENT
> +	if (cpmsg->size > DATA_FRAGMENT * sizeof(__u8))
> +		return HV_E_FAIL;
> +

- C style comments for coding style, also sizeof(__u8) is by definition 1
  so it's perhaps surplus ?

Also your patch block is devoid of a few thins like the file name...
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel





[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux