Message ID | 20180411190615.5149-1-yuval.shaia@oracle.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
On 2018/4/12 3:06, Yuval Shaia wrote: > Make sure num_qp is less than MAX_QP so we will not overrun my_dest > array. > > Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> Reviewed-by: Zhu Yanjun <yanjun.zhu@oracle.com> > --- > 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; > + } > + > num_wc = num_qp + rx_depth; > wc = alloca(num_wc * sizeof *wc); > -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Apr 11, 2018 at 10:06:15PM +0300, Yuval Shaia wrote: > Make sure num_qp is less than MAX_QP so we will not overrun my_dest > array. > > Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> > --- > v1 -> v2: > * Accept comment from Ruhl, Michael J > --- > libibverbs/examples/srq_pingpong.c | 6 ++++++ > 1 file changed, 6 insertions(+) > Thanks, applied.
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; + } + num_wc = num_qp + rx_depth; wc = alloca(num_wc * sizeof *wc);
Make sure num_qp is less than MAX_QP so we will not overrun my_dest array. Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> --- v1 -> v2: * Accept comment from Ruhl, Michael J --- libibverbs/examples/srq_pingpong.c | 6 ++++++ 1 file changed, 6 insertions(+)