• Dan Carpenter's avatar
    selinux: cleanup return codes in avtab_read_item() · 9e0bd4cb
    Dan Carpenter authored
    The avtab_read_item() function tends to return -1 as a default error
    code which is wrong (-1 means -EPERM).  I modified it to return
    appropriate error codes which is -EINVAL or the error code from
    next_entry() or insertf().
    
    next_entry() returns -EINVAL.
    insertf() is a function pointer to either avtab_insert() or
    cond_insertf().
    avtab_insert() returns -EINVAL, -ENOMEM, and -EEXIST.
    cond_insertf() currently returns -1, but I will fix it in a later patch.
    
    There is code in avtab_read() which translates the -1 returns from
    avtab_read_item() to -EINVAL. The translation is no longer needed, so I
    removed it.
    Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
    Acked-by: default avatarStephen D. Smalley <sds@tycho.nsa.gov>
    Signed-off-by: default avatarJames Morris <jmorris@namei.org>
    9e0bd4cb
avtab.c 12.5 KB