From: Pavel Pisa <pisa@cmp.felk.cvut.cz>
To: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>
Cc: "Pavel Pisa" <pisa@cmp.felk.cvut.cz>,
"Jason Wang" <jasowang@redhat.com>,
"Vikram Garhwal" <fnu.vikram@xilinx.com>,
"Ondrej Ille" <ondrej.ille@gmail.com>,
"Jan Charvát" <charvj10@fel.cvut.cz>
Subject: [PATCH for-5.2 v3 0/4] hw/net/can/ctucan: fix Coverity and other issues
Date: Tue, 10 Nov 2020 22:52:46 +0100 [thread overview]
Message-ID: <cover.1605044619.git.pisa@cmp.felk.cvut.cz> (raw)
Credit for finding and fixes goes to Peter Maydell
This patchset fixes a couple of issues spotted by Coverity:
* incorrect address checks meant the guest could write off the
end of the tx_buffer arrays
* we had an unused value in ctucan_send_ready_buffers()
and also some I noticed while reading the code:
* we don't adjust the device's non-portable use of bitfields
on bigendian hosts
* we should use stl_le_p() rather than casting uint_t* to
uint32_t*
Tested with "make check" only.
Changes v1->v2: don't assert() the can't-happen case in patch 1,
to allow for future adjustment of #defines that correspond to
h/w synthesis parameters.
Changes v2->v3: minnor corrections of range checking,
support for unaligned and partial word writes into Tx
buffers. Tested on x86_64 guest on x86_64 host and bige-edian
MIPS guest on x86_64 host Pavel Pisa.
Peter Maydell (4):
hw/net/can/ctucan: Don't allow guest to write off end of tx_buffer
hw/net/can/ctucan: Avoid unused value in ctucan_send_ready_buffers()
hw/net/can/ctucan_core: Handle big-endian hosts
hw/net/can/ctucan_core: Use stl_le_p to write to tx_buffers
hw/net/can/ctucan_core.c | 23 +++++++----------------
hw/net/can/ctucan_core.h | 3 +--
2 files changed, 8 insertions(+), 18 deletions(-)
--
2.20.1
next reply other threads:[~2020-11-10 21:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-10 21:52 Pavel Pisa [this message]
2020-11-10 21:52 ` [PATCH for-5.2 v3 1/4] hw/net/can/ctucan: Don't allow guest to write off end of tx_buffer Pavel Pisa
2020-11-10 21:52 ` [PATCH for-5.2 v3 2/4] hw/net/can/ctucan: Avoid unused value in ctucan_send_ready_buffers() Pavel Pisa
2020-11-10 21:52 ` [PATCH for-5.2 v3 3/4] hw/net/can/ctucan_core: Handle big-endian hosts Pavel Pisa
2020-11-10 21:52 ` [PATCH for-5.2 v3 4/4] hw/net/can/ctucan_core: Use stl_le_p to write to tx_buffers Pavel Pisa
2020-11-11 12:50 ` [PATCH for-5.2 v3 0/4] hw/net/can/ctucan: fix Coverity and other issues Jason Wang
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=cover.1605044619.git.pisa@cmp.felk.cvut.cz \
--to=pisa@cmp.felk.cvut.cz \
--cc=charvj10@fel.cvut.cz \
--cc=fnu.vikram@xilinx.com \
--cc=jasowang@redhat.com \
--cc=ondrej.ille@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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).