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

Roel Kluin roel.kluin at gmail.com
Wed Jun 17 07:11:23 PDT 2009


This prevents the memcpy of a guid_entries element using a negative index.

Signed-off-by: Roel Kluin <roel.kluin at gmail.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;
 	}



More information about the general mailing list