[ofa-general] Re: [PATCH] EHCA: Ensure that guid_entry index is positive

Alexander Schmidt alexs at linux.vnet.ibm.com
Tue Jun 23 00:49:13 PDT 2009


On Wed, 17 Jun 2009 16:11:23 +0200
Roel Kluin <roel.kluin at gmail.com> wrote:

> This prevents the memcpy of a guid_entries element using a negative index.
> 
> Signed-off-by: Roel Kluin <roel.kluin at gmail.com>

Acked-by: Alexander Schmidt <alexs at linux.vnet.ibm.com>

> ---
> Maybe this change then?
> 
> diff --git a/drivers/infiniband/hw/ehca/ehca_hca.c b/drivers/infiniband/hw/ehca/ehca_hca.c
> index 9209c53..bd9414b 100644
> --- a/drivers/infiniband/hw/ehca/ehca_hca.c
> +++ b/drivers/infiniband/hw/ehca/ehca_hca.c
> @@ -319,7 +319,7 @@ int ehca_query_gid(struct ib_device *ibdev, u8 port,
>  					      ib_device);
>  	struct hipz_query_port *rblock;
> 
> -	if (index > 255) {
> +	if (index > 255 || index < 0) {
>  		ehca_err(&shca->ib_device, "Invalid index: %x.", index);
>  		return -EINVAL;
>  	}
> _______________________________________________
> general mailing list
> general at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general
> 
> To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general



More information about the general mailing list