[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <19699d5f-29d7-4e14-b954-d612c5035b4a@kernel.org>
Date: Thu, 14 Mar 2024 20:34:43 -0600
From: David Ahern <dsahern@...nel.org>
To: Ratheesh Kannoth <rkannoth@...vell.com>,
Denis Kirjanov <kirjanov@...il.com>
Cc: stephen@...workplumber.org, netdev@...r.kernel.org,
Denis Kirjanov <dkirjanov@...e.de>
Subject: Re: [PATCH iproute2] ifstat: handle strdup return value
On 3/14/24 8:23 PM, Ratheesh Kannoth wrote:
>> diff --git a/misc/ifstat.c b/misc/ifstat.c
>> index 685e66c9..f94b11bc 100644
>> --- a/misc/ifstat.c
>> +++ b/misc/ifstat.c
>> @@ -140,6 +140,11 @@ static int get_nlmsg_extended(struct nlmsghdr *m, void *arg)
>>
>> n->ifindex = ifsm->ifindex;
>> n->name = strdup(ll_index_to_name(ifsm->ifindex));
>> + if (!n->name) {
>> + free(n);
>> + errno = ENOMEM;
> strdup() will set the errno right ? why do you need to set it explicitly ?
agreed.
pw-bot: cr
Powered by blists - more mailing lists