Commit 45b754ae authored by Christian Gromm's avatar Christian Gromm Committed by Greg Kroah-Hartman

staging: most: sound: add sanity check for function argument

This patch checks the function parameter 'bytes' before doing the
subtraction to prevent memory corruption.
Signed-off-by: default avatarChristian Gromm <christian.gromm@microchip.com>
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/1612282865-21846-1-git-send-email-christian.gromm@microchip.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 06b0c0dc
......@@ -86,6 +86,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];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment