From: "Saleem, Shiraz" <shiraz.saleem@intel.com>
To: Colin King <colin.king@canonical.com>,
"Ismail, Mustafa" <mustafa.ismail@intel.com>,
Doug Ledford <dledford@redhat.com>,
"Jason Gunthorpe" <jgg@ziepe.ca>,
"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>
Cc: "kernel-janitors@vger.kernel.org"
<kernel-janitors@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH][next] RDMA/irdma: Fix issues with u8 left shift operation
Date: Mon, 7 Jun 2021 14:54:17 +0000 [thread overview]
Message-ID: <28c79f11c1524d10b6bbe2c375c7c97e@intel.com> (raw)
In-Reply-To: <20210605122059.25105-1-colin.king@canonical.com>
> Subject: [PATCH][next] RDMA/irdma: Fix issues with u8 left shift operation
>
> From: Colin Ian King <colin.king@canonical.com>
>
> The shifting of the u8 integer info->map[i] the left will be promoted to a 32 bit
> signed int and then sign-extended to a u64. In the event that the top bit of the u8 is
> set then all then all the upper 32 bits of the u64 end up as also being set because
> of the sign-extension.
> Fix this by casting the u8 values to a u64 before the left shift. This
>
> Addresses-Coverity: ("Unitentional integer overflow / bad shift operation")
> Fixes: 3f49d6842569 ("RDMA/irdma: Implement HW Admin Queue OPs")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/infiniband/hw/irdma/ctrl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/hw/irdma/ctrl.c b/drivers/infiniband/hw/irdma/ctrl.c
> index 5aa112067bce..8bd3aecadaf6 100644
> --- a/drivers/infiniband/hw/irdma/ctrl.c
> +++ b/drivers/infiniband/hw/irdma/ctrl.c
> @@ -2157,7 +2157,7 @@ static enum irdma_status_code
> irdma_sc_set_up_map(struct irdma_sc_cqp *cqp,
> return IRDMA_ERR_RING_FULL;
>
> for (i = 0; i < IRDMA_MAX_USER_PRIORITY; i++)
> - temp |= info->map[i] << (i * 8);
> + temp |= (u64)info->map[i] << (i * 8);
>
Acked-by: Shiraz Saleem <shiraz.saleem@intel.com>
next prev parent reply other threads:[~2021-06-07 14:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-05 12:20 [PATCH][next] RDMA/irdma: Fix issues with u8 left shift operation Colin King
2021-06-07 14:54 ` Saleem, Shiraz [this message]
2021-06-07 23:45 ` Jason Gunthorpe
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=28c79f11c1524d10b6bbe2c375c7c97e@intel.com \
--to=shiraz.saleem@intel.com \
--cc=colin.king@canonical.com \
--cc=dledford@redhat.com \
--cc=jgg@ziepe.ca \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mustafa.ismail@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.