From: David Miller <davem@davemloft.net>
To: gustavo@embeddedor.com
Cc: netanel@amazon.com, saeedb@amazon.com, zorik@amazon.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] net: ena: fix unintended sign extension
Date: Wed, 17 Oct 2018 21:48:17 -0700 (PDT) [thread overview]
Message-ID: <20181017.214817.899061946206965862.davem@davemloft.net> (raw)
In-Reply-To: <20181012194948.GA24925@embeddedor.com>
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Date: Fri, 12 Oct 2018 21:49:48 +0200
> In the following expression:
>
> 372 size = io_sq->bounce_buf_ctrl.buffer_size *
> 373 io_sq->bounce_buf_ctrl.buffers_num;
>
> both buffer_size and buffers_num are of type u16 (16 bits, unsigned),
> so they are promoted to type int (32 bits, signed) and then
> sign-extended to type size_t.
>
> Fix this by casting io_sq->bounce_buf_ctrl.buffer_size to size_t in
> order to avoid the sign extension and unintended results.
>
> Addresses-Coverity-ID: 1474187 ("Unintended sign extension")
> Addresses-Coverity-ID: 1474189 ("Unintended sign extension")
> Fixes: 689b2bdaaa14 ("net: ena: add functions for handling Low Latency Queues in ena_com")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
I don't understand how this can possibly be a real problem, and it looks
therefore like we are just papering over a coverity warning.
I'm not applying this without more information and justification.
prev parent reply other threads:[~2018-10-18 4:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-12 19:49 [PATCH net-next] net: ena: fix unintended sign extension Gustavo A. R. Silva
2018-10-18 4:48 ` David Miller [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=20181017.214817.899061946206965862.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=gustavo@embeddedor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netanel@amazon.com \
--cc=netdev@vger.kernel.org \
--cc=saeedb@amazon.com \
--cc=zorik@amazon.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).