Commit 08cfbe7a authored by Artem Sadovnikov's avatar Artem Sadovnikov Committed by Greg Kroah-Hartman
Browse files

refscale: Check that nreaders and loops multiplication doesn't overflow



[ Upstream commit 005b6187 ]

The nreaders and loops variables are exposed as module parameters, which,
in certain combinations, can lead to multiplication overflow.

Besides, loops parameter is defined as long, while through the code is
used as int, which can cause truncation on 64-bit kernels and possible
zeroes where they shouldn't appear.

Since code uses result of multiplication as int anyway, it only makes sense
to replace loops with int. Multiplication overflow check is also added
due to possible multiplication between two very big numbers.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 653ed64b ("refperf: Add a test to measure performance of read-side synchronization")
Signed-off-by: default avatarArtem Sadovnikov <a.sadovnikov@ispras.ru>
Signed-off-by: default avatarNeeraj Upadhyay (AMD) <neeraj.upadhyay@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent ac984f61
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment