On Jun 6, 2012, at 12:26 PM, Alex Elder wrote:
>> diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c
>> index 29ad46e..f80afc3 100644
>> --- a/net/ceph/osdmap.c
>> +++ b/net/ceph/osdmap.c
>> @@ -495,15 +495,12 @@ static int __decode_pool_names(void **p, void *end, 
>> struct ceph_osdmap *map)
>>              ceph_decode_32_safe(p, end, pool, bad);
>>              ceph_decode_32_safe(p, end, len, bad);
>>              dout("  pool %d len %d\n", pool, len);
>> +            ceph_decode_need(p, end, len, bad);
>>              pi = __lookup_pg_pool(&map->pg_pools, pool);
>>              if (pi) {
>>                      kfree(pi->name);
>> -                    pi->name = kmalloc(len + 1, GFP_NOFS);
>> -                    if (pi->name) {
>> -                            memcpy(pi->name, *p, len);
>> -                            pi->name[len] = '\0';
>> -                            dout("  name is %s\n", pi->name);
>> -                    }
>> +                    pi->name = kstrndup(*p, len, GFP_NOFS);
>> +                    dout("  name is %s\n", pi->name);
> 
> Instead:
>               if (pi) {
>                       char *name = kstrndup(*p, len, GFP_NOFS);
> 
>                       if (!name)
>                               return -ENOMEM;
>                       kfree(pi->name);
>                       pi->name = name;
>                       dout("  name is %s\n", pi->name);
>               }

Looks good to me.  Thanks!

Do you want me to send another patch?

- xi

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to