Преглед на файлове

IB/ehca: Ensure that guid_entry index is not negative

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

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Roel Kluin преди 16 години
родител
ревизия
af04662b4d
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      drivers/infiniband/hw/ehca/ehca_hca.c

+ 1 - 1
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 < 0 || index > 255) {
 		ehca_err(&shca->ib_device, "Invalid index: %x.", index);
 		return -EINVAL;
 	}