mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
staging: most: sound: add sanity check for function argument
[ Upstream commit 45b754ae5b
]
This patch checks the function parameter 'bytes' before doing the
subtraction to prevent memory corruption.
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/1612282865-21846-1-git-send-email-christian.gromm@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
0f47da6187
commit
671f2a7a4a
1 changed files with 2 additions and 0 deletions
|
@ -92,6 +92,8 @@ static void swap_copy24(u8 *dest, const u8 *source, unsigned int bytes)
|
|||
{
|
||||
unsigned int i = 0;
|
||||
|
||||
if (bytes < 2)
|
||||
return;
|
||||
while (i < bytes - 2) {
|
||||
dest[i] = source[i + 2];
|
||||
dest[i + 1] = source[i + 1];
|
||||
|
|
Loading…
Reference in a new issue