[apparmor] [PATCH 01/24] apparmor: provide base for multiple profiles to be replaced at once
Seth Arnold
seth.arnold at canonical.com
Fri Mar 1 02:01:34 UTC 2013
On Wed, Feb 27, 2013 at 10:14:00AM -0800, John Johansen wrote:
> * aa_replace_profiles - replace profile(s) on the profile list
> * @udata: serialized data stream (NOT NULL)
> * @size: size of the serialized data stream
...
> */
> ssize_t aa_replace_profiles(void *udata, size_t size, bool noreplace)
> {
...
> + error = aa_unpack(udata, size, &lh, &ns_name);
> + if (error)
> + goto out;
I thought the return values from this function looked a bit complicated:
size of the read policy (which was passed in and apparently not modified
by this function) _or_ an error code (which is sometimes PTR_ERR() and
sometimes an explicit -ENOMEM or -EPROTONOSUPPORT).
The return types used in these call chains is confusing to me;
aa_replace_profiles() returns an 'ssize_t', aa_unpack() returns an
'int'. The PTR_ERR macros take 'long' arguments but cast them through
'unsigned long' on their way through 'void *' types.
I think everything works out fine in the end, but I'd feel better if the
return values were standardized through more of the call chains and if
the return values here were more consistent. (If the 'size' parameter
isn't updated in the function, using it for success / failure feels odd.)
Thanks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20130228/d4b1ff89/attachment.pgp>
More information about the AppArmor
mailing list