Re: [PATCH for v4.6] lib/stackdepot: avoid to return 0 handle

From: Joonsoo Kim
Date: Wed May 04 2016 - 11:17:21 EST


2016-05-04 17:34 GMT+09:00 Alexander Potapenko <glider@xxxxxxxxxx>:
> On Tue, May 3, 2016 at 7:13 AM, <js1304@xxxxxxxxx> wrote:
>> From: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx>
>>
>> Recently, we allow to save the stacktrace whose hashed value is 0.
>> It causes the problem that stackdepot could return 0 even if in success.
>> User of stackdepot cannot distinguish whether it is success or not so we
>> need to solve this problem. In this patch, 1 bit are added to handle
>> and make valid handle none 0 by setting this bit. After that, valid handle
>> will not be 0 and 0 handle will represent failure correctly.
> Returning success or failure doesn't require a special bit, we can
> just make depot_alloc_stack() return a boolean value.
> If I'm understanding correctly, your primary intention is to reserve
> an invalid handle value that will never collide with valid handles
> returned in the future.
> Can you reflect this in the description?

Indeed. I will add it in the description and respin the patch.

Thanks.