lkml.org 
[lkml]   [2017]   [May]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v5 1/2] selinux: add brief info to policydb
2017-05-17 17:34 GMT+02:00 William Roberts <bill.c.roberts@gmail.com>:
>>>>> Is there a particular reason to not just return policybrief_len here as
>>>>> well, for consistency in the interface? How do you intend to use this
>>>>> value in the caller?
>>>>
>>>> As called in the other patch to expose policy brief via selinuxfs
>>>> (sel_read_policybrief), the intent is to provide the caller with the
>>>> length of the string returned.
>>>> Or should I set *len to policy brief_len here, and just make the
>>>> caller aware that the returned length is in fact the length of the
>>>> buffer (i.e. including terminating NUL byte)?
>>>
>>> What is the caller supposed to do with length? This interface seemed kind of
>>> odd. If it's guaranteed NUL byte terminated, do they even need length?
>>
>> The length is useful as an input parameter in case the caller provides
>> its own buffer (instead of letting the function allocate one), and as
>
> This is what I don't get, why doesn't the function just always allocate?

For performance reasons mainly. The caller would have a statically
allocated buffer, reused every time it needs to get the policy brief
info.

\
 
 \ /
  Last update: 2017-05-17 17:44    [W:1.036 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site