Re: [PATCH] leak_check: Improve ZERO_SIZE_PTR handling

21 views
Skip to first unread message

Eugene Shatokhin

unread,
Sep 11, 2012, 5:31:34 AM9/11/12
to Alexey Khoroshilov, tsyv...@ispras.ru, kedr-d...@googlegroups.com
Hi, Alexey,

Thank you for pointing this out.

Yes, __krealloc() may return ZERO_SIZE_PTR and this case should be
handled. Perhaps, kmemdup() with len == 0 may do that too. I cannot
say if it is legal to call it this way but OK, assume it may happen.

However, I cannot see from the sources of kstrdup() and kstrndup() how
these functions can return ZERO_SIZE_PTR. Any ideas?

Eugene

Alexey Khoroshilov

unread,
Sep 13, 2012, 11:30:50 AM9/13/12
to Eugene Shatokhin, tsyv...@ispras.ru, kedr-d...@googlegroups.com
On 09/11/2012 01:31 PM, Eugene Shatokhin wrote:
> Hi, Alexey,
>
> Thank you for pointing this out.
>
> Yes, __krealloc() may return ZERO_SIZE_PTR and this case should be
> handled. Perhaps, kmemdup() with len == 0 may do that too. I cannot
> say if it is legal to call it this way but OK, assume it may happen.
That was the cause of a false positive during my testing.
>
> However, I cannot see from the sources of kstrdup() and kstrndup() how
> these functions can return ZERO_SIZE_PTR. Any ideas?
Agree, it is a consequence of initial opening kstrdup.data instead of
kmemdup.data.

--
Alexey

Eugene Shatokhin

unread,
Sep 14, 2012, 3:03:08 PM9/14/12
to Alexey Khoroshilov, tsyv...@ispras.ru, kedr-d...@googlegroups.com
Applied the part of the patch for __krealloc.data and kmemdup.data
with cosmetic modifications.

Thanks!
Reply all
Reply to author
Forward
0 new messages