Skip to content

Commit

Permalink
lib/test_kasan.c: make kmalloc_oob_krealloc_less more correctly
Browse files Browse the repository at this point in the history
In kmalloc_oob_krealloc_less, I think it is better to test
the size2 boundary.

If we do not call krealloc, the access of position size1 will still cause
out-of-bounds and access of position size2 does not.  After call krealloc,
the access of position size2 cause out-of-bounds.  So using size2 is more
correct.

Signed-off-by: Wang Long <[email protected]>
Cc: Andrey Ryabinin <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
datawolf authored and torvalds committed Sep 10, 2015
1 parent 9789d8e commit 6b4a35f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/test_kasan.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ static noinline void __init kmalloc_oob_krealloc_less(void)
kfree(ptr1);
return;
}
ptr2[size1] = 'x';
ptr2[size2] = 'x';
kfree(ptr2);
}

Expand Down

0 comments on commit 6b4a35f

Please sign in to comment.