[Mesa-dev] [PATCH 2/5] egl/android: use strcmp with drmVersion::name

Emil Velikov emil.l.velikov at gmail.com
Mon Aug 13 15:47:51 UTC 2018


On 13 August 2018 at 16:21, Tomasz Figa <tfiga at chromium.org> wrote:
> On Mon, Aug 13, 2018 at 11:48 PM Emil Velikov <emil.l.velikov at gmail.com> wrote:
>>
>> From: Emil Velikov <emil.velikov at collabora.com>
>>
>> The name string is guaranteed to be NULL terminated. Drop the explicit
>> length check that comes with strncmp().
>
> Is there anything wrong with that length check? I feel like it's a
> good practice to keep it anyway.
>
Consider the a long DRM driver name, that goes over PROPERTY_VALUE_MAX.
One could replace it with min(PROP.., version::name_len), although it
does seem over pedantic.

I'm yet to see a single instance that does strncmp for the name.

Emil


More information about the mesa-dev mailing list