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 | 40 ++++++++++++++++++++++++---------------- 1 files changed, 24 insertions(+), 16 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-03-19 17:51:49.447730944 -0800 +++ 25-akpm/security/selinux/avc.c 2004-03-19 17:51:49.450730488 -0800 @@ -25,7 +25,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" @@ -540,8 +542,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; @@ -566,7 +568,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); @@ -592,6 +595,8 @@ void avc_audit(u32 ssid, u32 tsid, struct sock *sk = a->u.net.sk; struct unix_sock *u; struct inet_opt *inet; + int len = 0; + char *p = NULL; switch (sk->sk_family) { case AF_INET: @@ -607,17 +612,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; } } @@ -628,7 +637,8 @@ void avc_audit(u32 ssid, u32 tsid, "daddr", "dest"); if (a->u.net.netif) - audit_log_format(ab, " netif=%s", a->u.net.netif); + audit_log_format(ab, " netif=%s", + a->u.net.netif); break; } } @@ -1063,5 +1073,3 @@ int avc_has_perm(u32 ssid, u32 tsid, u16 avc_audit(ssid, tsid, tclass, requested, &avd, rc, auditdata); return rc; } - - _