From: Roel Kluin Date: Tue, 23 Jun 2009 05:23:48 +0000 (-0700) Subject: IB/ehca: Ensure that guid_entry index is not negative X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=af04662b4d80de5797a595bc9855d09ef4fe55cc;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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 Signed-off-by: Roland Dreier --- diff --git a/drivers/infiniband/hw/ehca/ehca_hca.c b/drivers/infiniband/hw/ehca/ehca_hca.c index 9209c5332dfe..8b92f85d4dd0 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 < 0 || index > 255) { ehca_err(&shca->ib_device, "Invalid index: %x.", index); return -EINVAL; }