linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pmcraid: redundant check in pmcraid_check_ioctl_buffer()?
@ 2009-10-21 14:41 Roel Kluin
  2009-10-22 20:37 ` Anil Ravindranath
  0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-10-21 14:41 UTC (permalink / raw)
  To: anil_ravindranath, linux-scsi, Andrew Morton

struct pmcraid_ioctl_header member buffer_length is unsigned, so
this check appears redundant.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
Or should we replace it by a check like
if (hdr->buffer_length > MAX) ... ?

diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index f7c70e2..e448776 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -3731,12 +3731,6 @@ static int pmcraid_check_ioctl_buffer(
 		return -EINVAL;
 	}
 
-	/* buffer length can't be negetive */
-	if (hdr->buffer_length < 0) {
-		pmcraid_err("ioctl: invalid buffer length specified\n");
-		return -EINVAL;
-	}
-
 	/* check for appropriate buffer access */
 	if ((_IOC_DIR(cmd) & _IOC_READ) == _IOC_READ)
 		access = VERIFY_WRITE;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] pmcraid: redundant check in pmcraid_check_ioctl_buffer()?
  2009-10-21 14:41 [PATCH] pmcraid: redundant check in pmcraid_check_ioctl_buffer()? Roel Kluin
@ 2009-10-22 20:37 ` Anil Ravindranath
  0 siblings, 0 replies; 2+ messages in thread
From: Anil Ravindranath @ 2009-10-22 20:37 UTC (permalink / raw)
  To: Roel Kluin; +Cc: linux-scsi, Andrew Morton, anil_ravindranath

I agree this check is not necessary.

Signed-off-by: Anil Ravindranath <anil_ravindranath@pmc-sierra.com>

On Wed, 21 Oct 2009, Roel Kluin wrote:

> struct pmcraid_ioctl_header member buffer_length is unsigned, so
> this check appears redundant.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> Or should we replace it by a check like
> if (hdr->buffer_length > MAX) ... ?
> 
> diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
> index f7c70e2..e448776 100644
> --- a/drivers/scsi/pmcraid.c
> +++ b/drivers/scsi/pmcraid.c
> @@ -3731,12 +3731,6 @@ static int pmcraid_check_ioctl_buffer(
>  		return -EINVAL;
>  	}
>  
> -	/* buffer length can't be negetive */
> -	if (hdr->buffer_length < 0) {
> -		pmcraid_err("ioctl: invalid buffer length specified\n");
> -		return -EINVAL;
> -	}
> -
>  	/* check for appropriate buffer access */
>  	if ((_IOC_DIR(cmd) & _IOC_READ) == _IOC_READ)
>  		access = VERIFY_WRITE;
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-10-22 21:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-21 14:41 [PATCH] pmcraid: redundant check in pmcraid_check_ioctl_buffer()? Roel Kluin
2009-10-22 20:37 ` Anil Ravindranath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).