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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Eric,

On 28 June 2018 at 11:21, Eric Engestrom <eric@xxxxxxxxxxxx> 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
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux