[PATCH] a multiplication overflow in drivers/pps/pps.c
From: xqx12
Date: Wed Dec 18 2013 - 02:36:40 EST
there is an overflow in the following code :
ticks = fdata.timeout.sec * HZ;
while ticks is a signed 64-bit, but the result of fdata.timeout.sec *
HZ will be converted be 32-bit first. So ticks will be a wrong value
after multiplication overflow.
Reported-by: Qixue Xiao <xiaoqixue_1@xxxxxxx>
Suggested-by: Yongjian Xu <xuyongjiande@xxxxxxxxx>
Suggested-by: Yu Chen <chyyuu@xxxxxxxxx>
Signed-off-by: Qixue Xiao <xiaoqixue_1@xxxxxxx>
---
drivers/pps/pps.c | 2 +-
gentags.sh | 4 +++
memory_leak.txt | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 93 insertions(+), 1 deletion(-)
create mode 100755 gentags.sh
create mode 100644 memory_leak.txt
diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c
index 2f07cd6..44ddd22 100644
--- a/drivers/pps/pps.c
+++ b/drivers/pps/pps.c
@@ -164,7 +164,7 @@ static long pps_cdev_ioctl(struct file *file,
dev_dbg(pps->dev, "timeout %lld.%09d\n",
(long long) fdata.timeout.sec,
fdata.timeout.nsec);
- ticks = fdata.timeout.sec * HZ;
+ ticks = (s64)(fdata.timeout.sec) * HZ;
ticks += fdata.timeout.nsec / (NSEC_PER_SEC / HZ);
if (ticks != 0) {
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/