linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ov9655: fix potential integer overflow
@ 2017-09-20  2:41 Gustavo A. R. Silva
  2017-09-21 13:19 ` kbuild test robot
  2017-09-21 17:31 ` kbuild test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2017-09-20  2:41 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media, linux-kernel, Gustavo A. R. Silva

Add suffix ULL to constant 10000 rather than casting the result of the
operation in order to avoid a potential integer overflow. This constant
is used in a context that expects an expression of type u64.

Addresses-Coverity-ID: 1324146
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/media/i2c/ov9650.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/ov9650.c b/drivers/media/i2c/ov9650.c
index 6ffb460..91a09ee 100644
--- a/drivers/media/i2c/ov9650.c
+++ b/drivers/media/i2c/ov9650.c
@@ -1129,8 +1129,8 @@ static int __ov965x_set_frame_interval(struct ov965x *ov965x,
 	if (fi->interval.denominator == 0)
 		return -EINVAL;
 
-	req_int = (u64)(fi->interval.numerator * 10000) /
-		fi->interval.denominator;
+	req_int = (fi->interval.numerator * 10000ULL) /
+		  fi->interval.denominator;
 
 	for (i = 0; i < ARRAY_SIZE(ov965x_intervals); i++) {
 		const struct ov965x_interval *iv = &ov965x_intervals[i];
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ov9655: fix potential integer overflow
  2017-09-20  2:41 [PATCH] ov9655: fix potential integer overflow Gustavo A. R. Silva
@ 2017-09-21 13:19 ` kbuild test robot
  2017-09-21 17:31 ` kbuild test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2017-09-21 13:19 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: kbuild-all, Mauro Carvalho Chehab, linux-media, linux-kernel,
	Gustavo A. R. Silva

[-- Attachment #1: Type: text/plain, Size: 832 bytes --]

Hi Gustavo,

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v4.14-rc1 next-20170921]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Gustavo-A-R-Silva/ov9655-fix-potential-integer-overflow/20170921-174735
base:   git://linuxtv.org/media_tree.git master
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

>> ERROR: "__udivdi3" [drivers/media/i2c/ov9650.ko] undefined!

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 61141 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ov9655: fix potential integer overflow
  2017-09-20  2:41 [PATCH] ov9655: fix potential integer overflow Gustavo A. R. Silva
  2017-09-21 13:19 ` kbuild test robot
@ 2017-09-21 17:31 ` kbuild test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2017-09-21 17:31 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: kbuild-all, Mauro Carvalho Chehab, linux-media, linux-kernel,
	Gustavo A. R. Silva

[-- Attachment #1: Type: text/plain, Size: 999 bytes --]

Hi Gustavo,

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v4.14-rc1 next-20170921]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Gustavo-A-R-Silva/ov9655-fix-potential-integer-overflow/20170921-174735
base:   git://linuxtv.org/media_tree.git master
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All errors (new ones prefixed by >>):

>> ERROR: "__aeabi_uldivmod" [drivers/media/i2c/ov9650.ko] undefined!

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 63497 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-21 17:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-20  2:41 [PATCH] ov9655: fix potential integer overflow Gustavo A. R. Silva
2017-09-21 13:19 ` kbuild test robot
2017-09-21 17:31 ` kbuild test robot

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).