pmaports/device/unmaintained/linux-xiaomi-cepheus-downstream/0002-ipa_v3-fix-potential-buffer-overflow.patch

28 lines
949 B
Diff

From 3f7040a432fd468247e971c1ef7a9d69c8075968 Mon Sep 17 00:00:00 2001
From: Alexey Min <alexey.min@gmail.com>
Date: Wed, 14 Jul 2021 01:11:53 +0300
Subject: [PATCH 2/7] ipa_v3: fix potential buffer overflow
This causes compile errors!
Signed-off-by: Alexey Min <alexey.min@gmail.com>
---
drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c b/drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c
index 0cf0e60617b9..0183894a32d7 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c
@@ -2069,7 +2069,7 @@ static ssize_t ipa_debugfs_enable_disable_drop_stats(struct file *file,
goto bail;
}
- missing = copy_from_user(dbg_buff, ubuf, count);
+ missing = copy_from_user(dbg_buff, ubuf, min(sizeof(dbg_buff), count));
if (missing) {
ret = -EFAULT;
goto bail;
--
2.40.1