security/selinux/avc.c: In function `avc_audit': security/selinux/avc.c:612: warning: unused variable `len' security/selinux/avc.c: At top level: security/selinux/include/class_to_string.h:5: warning: `class_to_string' defined but not used --- 25-akpm/security/selinux/avc.c | 37 ++++++++++++++++++++++--------------- 1 files changed, 22 insertions(+), 15 deletions(-) diff -puN security/selinux/avc.c~lightweight-auditing-framework-warning-fix security/selinux/avc.c --- 25/security/selinux/avc.c~lightweight-auditing-framework-warning-fix 2004-04-04 17:08:54.413510432 -0700 +++ 25-akpm/security/selinux/avc.c 2004-04-04 17:09:42.244239056 -0700 @@ -27,7 +27,9 @@ #include #include "avc.h" #include "avc_ss.h" +#ifdef CONFIG_AUDIT #include "class_to_string.h" +#endif #include "common_perm_to_string.h" #include "av_inherit.h" #include "av_perm_to_string.h" @@ -552,8 +554,8 @@ void avc_audit(u32 ssid, u32 tsid, if ((vma->vm_flags & VM_EXECUTABLE) && vma->vm_file) { audit_log_d_path(ab, "exe=", - vma->vm_file->f_dentry, - vma->vm_file->f_vfsmnt); + vma->vm_file->f_dentry, + vma->vm_file->f_vfsmnt); break; } vma = vma->vm_next; @@ -578,7 +580,8 @@ void avc_audit(u32 ssid, u32 tsid, if (a->u.fs.dentry) { struct dentry *dentry = a->u.fs.dentry; if (a->u.fs.mnt) { - audit_log_d_path(ab, "path=", dentry, a->u.fs.mnt); + audit_log_d_path(ab, "path=", dentry, + a->u.fs.mnt); } else { audit_log_format(ab, " name=%s", dentry->d_name.name); @@ -603,6 +606,8 @@ void avc_audit(u32 ssid, u32 tsid, if (a->u.net.sk) { struct sock *sk = a->u.net.sk; struct unix_sock *u; + int len = 0; + char *p = NULL; switch (sk->sk_family) { case AF_INET: { @@ -632,17 +637,21 @@ void avc_audit(u32 ssid, u32 tsid, u = unix_sk(sk); if (u->dentry) { audit_log_d_path(ab, "path=", - u->dentry, u->mnt); - } else if (u->addr) { - int len = u->addr->len-sizeof(short); - char *p = &u->addr->name->sun_path[0]; - if (*p) - audit_log_format(ab, "path=%*.*s", - len, len, p); - else - audit_log_format(ab, "path=@%*.*s", - len-1, len-1, p+1); + u->dentry, u->mnt); + break; } + if (!u->addr) + break; + len = u->addr->len-sizeof(short); + p = &u->addr->name->sun_path[0]; + if (*p) + audit_log_format(ab, + "path=%*.*s", len, + len, p); + else + audit_log_format(ab, + "path=@%*.*s", len-1, + len-1, p+1); break; } } @@ -1102,5 +1111,3 @@ int avc_has_perm(u32 ssid, u32 tsid, u16 avc_audit(ssid, tsid, tclass, requested, &avd, rc, auditdata); return rc; } - - _