Mercurial > illumos > illumos-gate
changeset 13142:96bc3a30c4fe
6925150 audit_closef() may reference unintialized variable 'getattr_ret'
author | Marek Pospisil <Marek.Pospisil@Sun.COM> |
---|---|
date | Mon, 16 Aug 2010 16:30:37 -0700 |
parents | a0d1fd11335b |
children | 87d7bfd32811 |
files | usr/src/uts/common/c2/audit.c |
diffstat | 1 files changed, 12 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/common/c2/audit.c Mon Aug 16 16:30:31 2010 -0700 +++ b/usr/src/uts/common/c2/audit.c Mon Aug 16 16:30:37 2010 -0700 @@ -737,10 +737,10 @@ struct vattr attr; au_emod_t evmod = 0; const auditinfo_addr_t *ainfo; - int getattr_ret; cred_t *cr; au_kcontext_t *kctx = GET_KCTX_PZ; uint32_t auditing; + boolean_t audit_attr = B_FALSE; fad = F2A(fp); estate = kctx->auk_ets[AUE_CLOSE]; @@ -776,16 +776,16 @@ */ if ((vp = fp->f_vnode) != NULL) { attr.va_mask = AT_ALL; - getattr_ret = VOP_GETATTR(vp, &attr, 0, CRED(), NULL); - } - - /* - * When write was not used and the file can be considered public, - * then skip the audit. - */ - if ((getattr_ret == 0) && ((fp->f_flag & FWRITE) == 0)) { - if (object_is_public(&attr)) { - return; + if (VOP_GETATTR(vp, &attr, 0, CRED(), NULL) == 0) { + if ((fp->f_flag & FWRITE) == 0 && + object_is_public(&attr)) { + /* + * When write was not used and the file can be + * considered public, then skip the audit. + */ + return; + } + audit_attr = B_TRUE; } } @@ -802,7 +802,7 @@ #endif } - if (getattr_ret == 0) { + if (audit_attr) { au_write((caddr_t *)&(ad), au_to_attr(&attr)); audit_sec_attributes((caddr_t *)&(ad), vp); }