Re: [PATCH 2/2] kasan: add test for invalid size in memmove

From: Walter Wu
Date: Mon Oct 14 2019 - 11:57:20 EST


On Mon, 2019-10-14 at 08:07 -0700, Matthew Wilcox wrote:
> On Mon, Oct 14, 2019 at 06:36:54PM +0800, Walter Wu wrote:
> > Test size is negative numbers in memmove in order to verify
> > whether it correctly get KASAN report.
>
> You're not testing negative numbers, though. memmove() takes an unsigned
> type, so you're testing a very large number.
>
Casting negative numbers to size_t would indeed turn up as a "large"
size_t and its value will be larger than ULONG_MAX/2. We mainly want to
express this case. Maybe we can add some descriptions. Thanks for your
reminder.