[dpdk-dev] [PATCH] eal: prevent dereferencing NULL pointer in rte_eal_devargs_add()
Wiles, Keith
keith.wiles at intel.com
Mon Mar 2 15:40:09 CET 2015
On 3/2/15, 6:23 AM, "David Marchand" <david.marchand at 6wind.com> wrote:
>Hello Pawel,
>
>On Mon, Mar 2, 2015 at 12:09 PM, Pawel Wodkowski
><pawelx.wodkowski at intel.com
>> wrote:
>
>> On failure devargs->args should not be accesed if devargs is NULL.
>>
>
>accessed.
>
>
>>
>> Signed-off-by: Pawel Wodkowski <pawelx.wodkowski at intel.com>
>> ---
>> lib/librte_eal/common/eal_common_devargs.c | 7 ++++---
>> 1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/lib/librte_eal/common/eal_common_devargs.c
>> b/lib/librte_eal/common/eal_common_devargs.c
>> index 9b110f7..615945e 100644
>> --- a/lib/librte_eal/common/eal_common_devargs.c
>> +++ b/lib/librte_eal/common/eal_common_devargs.c
>> @@ -124,12 +124,13 @@ rte_eal_devargs_add(enum rte_devtype devtype,
>>const
>> char *devargs_str)
>> return 0;
>>
>> fail:
>> - if (devargs->args)
>> - free(devargs->args);
>> if (buf)
>> free(buf);
>> - if (devargs)
>> + if (devargs) {
>> + free(devargs->args);
Do you not still need to check for args being NULL before calling free?
>> free(devargs);
>> + }
>> +
>> return -1;
>> }
>>
>>
>Fixes: c07691ae1089 ("devargs: remove limit on parameters length")
>Acked-by: David Marchand <david.marchand at 6wind.com>
>
>--
>David Marchand
More information about the dev
mailing list