[PATCH libdrm 05/10] xf86drm: introduce a get_real_pci_path() helper

Emil Velikov emil.l.velikov at gmail.com
Thu Jun 28 16:42:00 UTC 2018


Hi Eric,

On 28 June 2018 at 11:21, Eric Engestrom <eric at engestrom.ch> wrote:

>> @@ -2992,16 +2992,37 @@ static int drmParseSubsystemType(int maj, int min)
>>  #endif
>>  }
>>
>> +static char *
>> +get_real_pci_path(int maj, int min)
>> +{
>> +    char path[PATH_MAX + 1];
>> +    char *real_path = malloc(PATH_MAX);
>
> Why not allocate this on the stack and pass it in?
> It would avoid the error handling you had to add in this patch :)
>
As always, thanks for having a look.

I was mostly hesitant since some callers already have a char foo[PATH_MAX +1].
Thinking about it - the default stack size should be enough to
accommodate an extra ~4k bytes.

Will fix.

Thanks
Emil


More information about the dri-devel mailing list