* [PATCH v3 0/8] use 64-bit arithmetic instead of 32-bit
@ 2018-02-06 16:46 Gustavo A. R. Silva
2018-02-06 16:51 ` [PATCH v3 6/8] rockchip/rga: " Gustavo A. R. Silva
0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2018-02-06 16:46 UTC (permalink / raw)
To: linux-arm-kernel
Add suffix LL and ULL to various constants in order to give the compiler
complete information about the proper arithmetic to use. Such constants
are used in contexts that expect expressions of type u64 (64 bits, unsigned)
and s64 (64 bits, signed).
The mentioned expressions are currently being evaluated using 32-bit
arithmetic, wich in some cases can lead to unintentional integer
overflows.
This patchset addresses the following "Unintentional integer overflow"
Coverity reports:
CIDs: 200604, 1056807, 1056808, 1271223, 1324146
CIDs: 1392628, 1392630, 1446589, 1454996, 1458347
Thank you
Changes in v2:
- Update subject and changelog to better reflect the proposed code changes.
- Add suffix ULL and LL to constants instead of casting variables.
- Extend the proposed code changes to other similar cases that had not
previously been considered in v1 of this patchset.
Changes in v3:
- Mention the specific Coverity report in all commit messages.
Gustavo A. R. Silva (8):
rtl2832: use 64-bit arithmetic instead of 32-bit in
rtl2832_set_frontend
dvb-frontends: ves1820: use 64-bit arithmetic instead of 32-bit
i2c: max2175: use 64-bit arithmetic instead of 32-bit
i2c: ov9650: use 64-bit arithmetic instead of 32-bit
pci: cx88-input: use 64-bit arithmetic instead of 32-bit
rockchip/rga: use 64-bit arithmetic instead of 32-bit
platform: sh_veu: use 64-bit arithmetic instead of 32-bit
platform: vivid-cec: use 64-bit arithmetic instead of 32-bit
drivers/media/dvb-frontends/rtl2832.c | 4 ++--
drivers/media/dvb-frontends/ves1820.c | 2 +-
drivers/media/i2c/max2175.c | 2 +-
drivers/media/i2c/ov9650.c | 9 +++++----
drivers/media/pci/cx88/cx88-input.c | 4 ++--
drivers/media/platform/rockchip/rga/rga-buf.c | 3 ++-
drivers/media/platform/sh_veu.c | 4 ++--
drivers/media/platform/vivid/vivid-cec.c | 11 +++++++++--
8 files changed, 24 insertions(+), 15 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH v3 6/8] rockchip/rga: use 64-bit arithmetic instead of 32-bit
2018-02-06 16:46 [PATCH v3 0/8] use 64-bit arithmetic instead of 32-bit Gustavo A. R. Silva
@ 2018-02-06 16:51 ` Gustavo A. R. Silva
0 siblings, 0 replies; 2+ messages in thread
From: Gustavo A. R. Silva @ 2018-02-06 16:51 UTC (permalink / raw)
To: linux-arm-kernel
Cast p to dma_addr_t in order to avoid a potential integer overflow.
This variable is being used in a context that expects an expression
of type dma_addr_t (u64).
The expression p << PAGE_SHIFT is currently being evaluated
using 32-bit arithmetic.
Addresses-Coverity-ID: 1458347 ("Unintentional integer overflow")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
Changes in v2:
- Update subject and changelog to better reflect the proposed code change.
Changes in v3:
- Mention the specific Coverity report in the commit message.
drivers/media/platform/rockchip/rga/rga-buf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/rockchip/rga/rga-buf.c b/drivers/media/platform/rockchip/rga/rga-buf.c
index 49cacc7..a43b57a 100644
--- a/drivers/media/platform/rockchip/rga/rga-buf.c
+++ b/drivers/media/platform/rockchip/rga/rga-buf.c
@@ -140,7 +140,8 @@ void rga_buf_map(struct vb2_buffer *vb)
address = sg_phys(sgl);
for (p = 0; p < len; p++) {
- dma_addr_t phys = address + (p << PAGE_SHIFT);
+ dma_addr_t phys = address +
+ ((dma_addr_t)p << PAGE_SHIFT);
pages[mapped_size + p] = phys;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-06 16:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-06 16:46 [PATCH v3 0/8] use 64-bit arithmetic instead of 32-bit Gustavo A. R. Silva
2018-02-06 16:51 ` [PATCH v3 6/8] rockchip/rga: " Gustavo A. R. Silva
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).