RE: [PATCH v2] libibverb/examples: Protect against memory corruption

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>-----Original Message-----
>From: Yuval Shaia [mailto:yuval.shaia@xxxxxxxxxx]
>Sent: Wednesday, April 11, 2018 3:06 PM
>To: dledford@xxxxxxxxxx; jgg@xxxxxxxxxxxx; leonro@xxxxxxxxxxxx; linux-
>rdma@xxxxxxxxxxxxxxx; Ruhl, Michael J <michael.j.ruhl@xxxxxxxxx>
>Cc: Yuval Shaia <yuval.shaia@xxxxxxxxxx>
>Subject: [PATCH v2] libibverb/examples: Protect against memory corruption
>
>Make sure num_qp is less than MAX_QP so we will not overrun my_dest
>array.
>
>Signed-off-by: Yuval Shaia <yuval.shaia@xxxxxxxxxx>
>---
>v1 -> v2:
>	* Accept comment from Ruhl, Michael J
>---
> libibverbs/examples/srq_pingpong.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
>diff --git a/libibverbs/examples/srq_pingpong.c
>b/libibverbs/examples/srq_pingpong.c
>index c289b463..014d114f 100644
>--- a/libibverbs/examples/srq_pingpong.c
>+++ b/libibverbs/examples/srq_pingpong.c
>@@ -759,6 +759,12 @@ int main(int argc, char *argv[])
> 		return 1;
> 	}
>
>+	if (num_qp >= MAX_QP) {
>+		fprintf(stderr, "num_qp %d must be less than %d\n", num_qp,
>+			MAX_QP - 1);
>+		return 1;
>+	}
>+

Looks good.

M

Reviewed-by: Michael J. Ruhl <michael.j.ruhl@xxxxxxxxx>


> 	num_wc = num_qp + rx_depth;
> 	wc     = alloca(num_wc * sizeof *wc);
>
>--
>2.14.3

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux