linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipr: Read buffer overflow
@ 2009-08-07 22:05 Roel Kluin
  2009-08-07 22:16 ` Brian King
  0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-08-07 22:05 UTC (permalink / raw)
  To: James E.J. Bottomley, linux-scsi, Andrew Morton

If `sglist->num_dma_sg' is zero we write ioadl[-1]

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
Is it possible for sglist->num_dma_sg to be 0?

diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 5f04550..736ad07 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -3004,8 +3004,9 @@ static void ipr_build_ucode_ioadl(struct ipr_cmnd *ipr_cmd,
 			cpu_to_be32(sg_dma_address(&scatterlist[i]));
 	}
 
-	ioadl[i-1].flags_and_data_len |=
-		cpu_to_be32(IPR_IOADL_FLAGS_LAST);
+	if (i != 0)
+		ioadl[i-1].flags_and_data_len |=
+			cpu_to_be32(IPR_IOADL_FLAGS_LAST);
 }
 
 /**

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

* Re: [PATCH] ipr: Read buffer overflow
  2009-08-07 22:05 [PATCH] ipr: Read buffer overflow Roel Kluin
@ 2009-08-07 22:16 ` Brian King
  0 siblings, 0 replies; 2+ messages in thread
From: Brian King @ 2009-08-07 22:16 UTC (permalink / raw)
  To: Roel Kluin; +Cc: James E.J. Bottomley, linux-scsi, Andrew Morton

Roel Kluin wrote:
> If `sglist->num_dma_sg' is zero we write ioadl[-1]
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> Is it possible for sglist->num_dma_sg to be 0?

No. Its not possible. The code in ipr_update_ioa_ucode ensures this.

Thanks,

Brian

> 
> diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
> index 5f04550..736ad07 100644
> --- a/drivers/scsi/ipr.c
> +++ b/drivers/scsi/ipr.c
> @@ -3004,8 +3004,9 @@ static void ipr_build_ucode_ioadl(struct ipr_cmnd *ipr_cmd,
>  			cpu_to_be32(sg_dma_address(&scatterlist[i]));
>  	}
> 
> -	ioadl[i-1].flags_and_data_len |=
> -		cpu_to_be32(IPR_IOADL_FLAGS_LAST);
> +	if (i != 0)
> +		ioadl[i-1].flags_and_data_len |=
> +			cpu_to_be32(IPR_IOADL_FLAGS_LAST);
>  }
> 
>  /**
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 
Brian King
Linux on Power Virtualization
IBM Linux Technology Center



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

end of thread, other threads:[~2009-08-07 22:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-07 22:05 [PATCH] ipr: Read buffer overflow Roel Kluin
2009-08-07 22:16 ` Brian King

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).