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
signature.asc
Description: Digital signature
-- AppArmor mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
