Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1291159 > unrolled thread
| Started by | Andrey Ryabinin <aryabinin@virtuozzo.com> |
|---|---|
| First post | 2015-12-14 13:50 +0100 |
| Last post | 2015-12-14 15:40 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH v2] sched/fair: fix mul overflow on 32-bit systems Andrey Ryabinin <aryabinin@virtuozzo.com> - 2015-12-14 13:50 +0100
Re: [PATCH v2] sched/fair: fix mul overflow on 32-bit systems Peter Zijlstra <peterz@infradead.org> - 2015-12-14 15:40 +0100
| From | Andrey Ryabinin <aryabinin@virtuozzo.com> |
|---|---|
| Date | 2015-12-14 13:50 +0100 |
| Subject | [PATCH v2] sched/fair: fix mul overflow on 32-bit systems |
| Message-ID | <qFAJH-6cU-21@gated-at.bofh.it> |
Make 'r' 64-bit type to avoid overflow in 'r * LOAD_AVG_MAX'
on 32-bit systems:
UBSAN: Undefined behaviour in kernel/sched/fair.c:2785:18
signed integer overflow:
87950 * 47742 cannot be represented in type 'int'
Fixes: 9d89c257dfb9 ("sched/fair: Rewrite runnable load and utilization average tracking")
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
Changes since v1:
- Removed wrong second hunk. Anyway, if fix for util_avg is needed,
it deserves a separte patch.
kernel/sched/fair.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 90e26b1..cfdc0e6 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2689,7 +2689,7 @@ static inline int update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq)
int decayed, removed = 0;
if (atomic_long_read(&cfs_rq->removed_load_avg)) {
- long r = atomic_long_xchg(&cfs_rq->removed_load_avg, 0);
+ s64 r = atomic_long_xchg(&cfs_rq->removed_load_avg, 0);
sa->load_avg = max_t(long, sa->load_avg - r, 0);
sa->load_sum = max_t(s64, sa->load_sum - r * LOAD_AVG_MAX, 0);
removed = 1;
--
2.4.10
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2015-12-14 15:40 +0100 |
| Message-ID | <qFCsa-7oI-3@gated-at.bofh.it> |
| In reply to | #1291159 |
On Mon, Dec 14, 2015 at 03:47:23PM +0300, Andrey Ryabinin wrote:
> Make 'r' 64-bit type to avoid overflow in 'r * LOAD_AVG_MAX'
> on 32-bit systems:
> UBSAN: Undefined behaviour in kernel/sched/fair.c:2785:18
> signed integer overflow:
> 87950 * 47742 cannot be represented in type 'int'
>
> Fixes: 9d89c257dfb9 ("sched/fair: Rewrite runnable load and utilization average tracking")
> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web