[firefly] [PATCH] net: replace kmalloc and memcpy by kmemdup

Silviu Popescu silviupopescu1990 at gmail.com
Fri Jul 19 11:48:39 EEST 2013


On Fri, Jul 19, 2013 at 9:53 AM, Daniel Baluta <daniel.baluta at gmail.com> wrote:
> On Thu, Jul 18, 2013 at 7:22 PM, Valentina Manea
> <valentina.manea.m at gmail.com> wrote:
>> This patch replaces kmalloc and memcpy usage for
>> duplicating a memory region by kmemdup.
>>
>> Signed-off-by: Valentina Manea <valentina.manea.m at gmail.com>
>> ---
>>  net/dns_resolver/dns_query.c |    3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/net/dns_resolver/dns_query.c b/net/dns_resolver/dns_query.c
>> index c32be29..4ac62fb 100644
>> --- a/net/dns_resolver/dns_query.c
>> +++ b/net/dns_resolver/dns_query.c
>> @@ -146,11 +146,10 @@ int dns_query(const char *type, const char *name, size_t namelen,
>>         len = upayload->datalen;
>>
>>         ret = -ENOMEM;
>> -       *_result = kmalloc(len + 1, GFP_KERNEL);
>> +       *_result = kmemdup(upayload->data, len + 1, GFP_KERNEL);
>>         if (!*_result)
>>                 goto put;
>>
>> -       memcpy(*_result, upayload->data, len + 1);
>>         if (_expiry)
>>                 *_expiry = rkey->expiry;
>
> Hi Tina,
>
> Your patch seems to be a duplicate of this
> http://lkml.indiana.edu/hypermail/linux/kernel/1303.1/04616.html

It's true that the patch seems to be a duplicate, yet the patch Daniel
mentioned received no reply and yesterday when I checked net-next the
change from kmalloc+memcpy to kmemdup was not made. Perhaps it was
overlooked it the past due to the large number of messages netdev
sees?

--
Silviu Popescu


More information about the firefly mailing list