From: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
To: Li Qiang <liq3ea@163.com>, yuval.shaia@oracle.com
Cc: qemu-devel@nongnu.org, peter.maydell@linaro.org
Subject: Re: [Qemu-devel] [PATCH] hw: rdma: fix an off-by-one issue
Date: Mon, 7 Jan 2019 19:31:06 +0200 [thread overview]
Message-ID: <da2973f5-174e-2621-ce2b-c1d5a6cd5a00@gmail.com> (raw)
In-Reply-To: <20190103131251.49271-1-liq3ea@163.com>
On 1/3/19 3:12 PM, Li Qiang wrote:
> In rdma_rm_get_backend_gid_index(), the 'sgid_idx' is used
> to index the array 'dev_res->port.gid_tbl' which size is
> MAX_PORT_GIDS. Current the 'sgid_idx' may be MAX_PORT_GIDS
> thus cause an off-by-one issue.
>
> Spotted by Coverity: CID 1398594
>
> Signed-off-by: Li Qiang <liq3ea@163.com>
> ---
> hw/rdma/rdma_rm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/rdma/rdma_rm.c b/hw/rdma/rdma_rm.c
> index f5b1295890..1bbc5f128f 100644
> --- a/hw/rdma/rdma_rm.c
> +++ b/hw/rdma/rdma_rm.c
> @@ -576,7 +576,7 @@ int rdma_rm_del_gid(RdmaDeviceResources *dev_res, RdmaBackendDev *backend_dev,
> int rdma_rm_get_backend_gid_index(RdmaDeviceResources *dev_res,
> RdmaBackendDev *backend_dev, int sgid_idx)
> {
> - if (unlikely(sgid_idx < 0 || sgid_idx > MAX_PORT_GIDS)) {
> + if (unlikely(sgid_idx < 0 || sgid_idx >= MAX_PORT_GIDS)) {
> pr_dbg("Got invalid sgid_idx %d\n", sgid_idx);
> return -EINVAL;
> }
Reviewed-by: Marcel Apfelbaum<marcel.apfelbaum@gmail.com>
Thanks,
Marcel
prev parent reply other threads:[~2019-01-07 17:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-03 13:12 [Qemu-devel] [PATCH] hw: rdma: fix an off-by-one issue Li Qiang
2019-01-07 17:31 ` Marcel Apfelbaum [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=da2973f5-174e-2621-ce2b-c1d5a6cd5a00@gmail.com \
--to=marcel.apfelbaum@gmail.com \
--cc=liq3ea@163.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=yuval.shaia@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).