diff options
author | Toomas Soome <tsoome@me.com> | 2019-01-20 13:26:57 +0200 |
---|---|---|
committer | Toomas Soome <tsoome@me.com> | 2019-04-23 22:57:31 +0300 |
commit | 0f48f68d9e0ad95b0edf718f68736cf3635a1f79 (patch) | |
tree | 0ef54b02371d4e7afc2320c98af680e2d0930310 | |
parent | a8eee26afa7ddf0c604c989c598251014bdc6e6f (diff) | |
download | illumos-joyent-0f48f68d9e0ad95b0edf718f68736cf3635a1f79.tar.gz |
10758 c2audit: NULL pointer errors
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r-- | usr/src/uts/common/c2/audit.c | 10 | ||||
-rw-r--r-- | usr/src/uts/common/c2/audit_event.c | 54 | ||||
-rw-r--r-- | usr/src/uts/common/c2/audit_io.c | 12 | ||||
-rw-r--r-- | usr/src/uts/common/c2/audit_start.c | 2 |
4 files changed, 32 insertions, 46 deletions
diff --git a/usr/src/uts/common/c2/audit.c b/usr/src/uts/common/c2/audit.c index 9084cd6d19..0553cca7b2 100644 --- a/usr/src/uts/common/c2/audit.c +++ b/usr/src/uts/common/c2/audit.c @@ -411,7 +411,7 @@ audit_symlink(struct pathname *pnp, struct pathname *sympath) * the specified file/directory attr) should be audited or * ignored. * - * returns: 1 - if audit policy and object attributes indicate that + * returns: 1 - if audit policy and object attributes indicate that * file/directory is effectively public. read events for * the file should not be audited. * 0 - otherwise @@ -526,7 +526,7 @@ audit_exit(int code, int what) /* * ROUTINE: AUDIT_CORE_START * PURPOSE: - * CALLBY: PSIG + * CALLBY: PSIG * NOTE: * TODO: */ @@ -928,7 +928,7 @@ audit_ipcget(int type, void *vp) return; switch (type) { - case NULL: + case 0: au_uwrite(au_to_ipc_perm((struct kipc_perm *)vp)); break; case AT_IPC_MSG: @@ -1298,7 +1298,7 @@ audit_enterprom(int flg) else au_write((caddr_t *)&(rp), au_to_return32(ECANCELED, 0)); - AUDIT_ASYNC_FINISH(rp, AUE_ENTERPROM, NULL, NULL); + AUDIT_ASYNC_FINISH(rp, AUE_ENTERPROM, 0, NULL); } @@ -1331,7 +1331,7 @@ audit_exitprom(int flg) else au_write((caddr_t *)&(rp), au_to_return32(ECANCELED, 0)); - AUDIT_ASYNC_FINISH(rp, AUE_EXITPROM, NULL, NULL); + AUDIT_ASYNC_FINISH(rp, AUE_EXITPROM, 0, NULL); } struct fcntla { diff --git a/usr/src/uts/common/c2/audit_event.c b/usr/src/uts/common/c2/audit_event.c index cb75b17e3c..1cb523121f 100644 --- a/usr/src/uts/common/c2/audit_event.c +++ b/usr/src/uts/common/c2/audit_event.c @@ -195,7 +195,7 @@ static void aus_socket(struct t_audit_data *); struct audit_s2e audit_s2e[] = { /* - * ---------- ---------- ---------- ---------- + * ---------- ---------- ---------- ---------- * INITIAL AUDIT START SYSTEM * PROCESSING EVENT PROCESSING CALL * ---------- ---------- ---------- ----------- @@ -866,7 +866,7 @@ aui_fchownat(au_event_t e) long flags; } *uap = (struct a *)clwp->lwp_ap; - if (uap->fname == NULL) + if (uap->fname == 0) e = AUE_FCHOWN; else if (uap->flags & AT_SYMLINK_NOFOLLOW) e = AUE_LCHOWN; @@ -969,7 +969,7 @@ aui_fchmodat(au_event_t e) long flag; } *uap = (struct a *)clwp->lwp_ap; - if (uap->fname == NULL) + if (uap->fname == 0) e = AUE_FCHMOD; else e = AUE_CHMOD; @@ -1000,7 +1000,7 @@ aus_fchmodat(struct t_audit_data *tad) au_uwrite(au_to_arg32(2, "new file mode", fmode&07777)); - if (fd == AT_FDCWD || uap->fname != NULL) /* same as chmod() */ + if (fd == AT_FDCWD || uap->fname != 0) /* same as chmod() */ return; /* @@ -1200,7 +1200,7 @@ aui_fstatat(au_event_t e) long flags; } *uap = (struct a *)clwp->lwp_ap; - if (uap->fnamep == NULL) + if (uap->fnamep == 0) e = AUE_FSTAT; else if (uap->flags & AT_SYMLINK_NOFOLLOW) e = AUE_LSTAT; @@ -1714,7 +1714,8 @@ auf_mknodat(struct t_audit_data *tad, int error, rval_t *rval) /*ARGSUSED*/ static void aus_mount(struct t_audit_data *tad) -{ /* AUS_START */ +{ + /* AUS_START */ klwp_t *clwp = ttolwp(curthread); uint32_t flags; uintptr_t u_fstype, dataptr; @@ -1747,21 +1748,19 @@ aus_mount(struct t_audit_data *tad) STRUCT_INIT(nfsargs, get_udatamodel()); bzero(STRUCT_BUF(nfsargs), STRUCT_SIZE(nfsargs)); - if (copyin((caddr_t)dataptr, - STRUCT_BUF(nfsargs), - MIN(uap->datalen, STRUCT_SIZE(nfsargs)))) { + if (copyin((caddr_t)dataptr, STRUCT_BUF(nfsargs), + MIN(uap->datalen, STRUCT_SIZE(nfsargs)))) { /* DEBUG debug_enter((char *)NULL); */ goto mount_free_fstype; } hostname = kmem_alloc(MAXNAMELEN, KM_SLEEP); if (copyinstr(STRUCT_FGETP(nfsargs, hostname), - (caddr_t)hostname, - MAXNAMELEN, &len)) { + (caddr_t)hostname, MAXNAMELEN, &len)) { goto mount_free_hostname; } au_uwrite(au_to_text(hostname)); au_uwrite(au_to_arg32(3, "internal flags", - (uint_t)STRUCT_FGET(nfsargs, flags))); + (uint_t)STRUCT_FGET(nfsargs, flags))); mount_free_hostname: kmem_free(hostname, MAXNAMELEN); @@ -2080,7 +2079,7 @@ aui_setpgrp(au_event_t e) case 0: /* getpgrp() - not security relevant */ case 2: /* getsid() - not security relevant */ - case 4: /* getpgid() - not security relevant */ + case 4: /* getpgid() - not security relevant */ e = AUE_NULL; break; @@ -3748,7 +3747,7 @@ auf_connect(struct t_audit_data *tad, int error, rval_t *rval) (void) socket_getsockname(so, (struct sockaddr *)so_laddr, &len, CRED()); if (error) { - if (uap->addr == NULL) + if (uap->addr == 0) break; if (uap->len <= 0) break; @@ -3998,8 +3997,7 @@ auf_setsockopt(struct t_audit_data *tad, int error, rval_t *rval) /*ARGSUSED*/ static void -aus_sockconfig(tad) - struct t_audit_data *tad; +aus_sockconfig(struct t_audit_data *tad) { struct a { long cmd; @@ -4342,7 +4340,7 @@ auf_recvfrom( bzero((void *)so_faddr, sizeof (so_faddr)); /* sanity check */ - if (uap->from == NULL) + if (uap->from == 0) break; /* sanity checks */ @@ -4730,7 +4728,7 @@ auf_sendto(struct t_audit_data *tad, int error, rval_t *rval) /* get peer address */ /* sanity check */ - if (uap->to == NULL) + if (uap->to == 0) break; /* sanity checks */ @@ -5427,10 +5425,7 @@ aus_facl(struct t_audit_data *tad) /*ARGSUSED*/ static void -auf_read(tad, error, rval) - struct t_audit_data *tad; - int error; - rval_t *rval; +auf_read(struct t_audit_data *tad, int error, rval_t *rval) { struct file *fp; struct f_audit_data *fad; @@ -5484,10 +5479,7 @@ auf_read(tad, error, rval) /*ARGSUSED*/ static void -auf_write(tad, error, rval) - struct t_audit_data *tad; - int error; - rval_t *rval; +auf_write(struct t_audit_data *tad, int error, rval_t *rval) { struct file *fp; struct f_audit_data *fad; @@ -5541,10 +5533,7 @@ auf_write(tad, error, rval) /*ARGSUSED*/ static void -auf_recv(tad, error, rval) - struct t_audit_data *tad; - int error; - rval_t *rval; +auf_recv(struct t_audit_data *tad, int error, rval_t *rval) { struct sonode *so; char so_laddr[sizeof (struct sockaddr_in6)]; @@ -5675,10 +5664,7 @@ auf_recv(tad, error, rval) /*ARGSUSED*/ static void -auf_send(tad, error, rval) - struct t_audit_data *tad; - int error; - rval_t *rval; +auf_send(struct t_audit_data *tad, int error, rval_t *rval) { struct sonode *so; char so_laddr[sizeof (struct sockaddr_in6)]; diff --git a/usr/src/uts/common/c2/audit_io.c b/usr/src/uts/common/c2/audit_io.c index 54624e791c..8d109e483e 100644 --- a/usr/src/uts/common/c2/audit_io.c +++ b/usr/src/uts/common/c2/audit_io.c @@ -72,8 +72,7 @@ static int state_if_not_part[] = { * Add the au_membuf to the descriptor chain and free the chain passed in. */ void -au_uwrite(m) - token_t *m; +au_uwrite(token_t *m) { au_write(&(u_ad), m); } @@ -231,9 +230,9 @@ void au_close_time(au_kcontext_t *kctx, token_t *dchain, int flag, au_event_t e_type, au_emod_t e_mod, timestruc_t *etime) { - token_t *record; /* au_membuf chain == the record */ + token_t *record; /* au_membuf chain == the record */ int byte_count; - token_t *m; /* for potential sequence token */ + token_t *m; /* for potential sequence token */ adr_t hadr; /* handle for header token */ adr_t sadr; /* handle for sequence token */ size_t zone_length; /* length of zonename token */ @@ -616,7 +615,8 @@ au_doormsg(au_kcontext_t *kctx, uint32_t message_code, void *message) * records in buffers of up to auk_queue.buflen in size. */ int -au_doorio(au_kcontext_t *kctx) { +au_doorio(au_kcontext_t *kctx) +{ off_t off; /* space used in buffer */ ssize_t used; /* space used in au_membuf */ token_t *cAR; /* current AR being processed */ @@ -812,7 +812,7 @@ audit_async_start(label_t *jb, au_event_t event, int sorf) if (sorf & AUM_FAIL) failure = kctx->auk_info.ai_namask.as_failure & estate; - if ((success | failure) == NULL) + if ((success | failure) == 0) return (1); ASSERT(tad->tad_errjmp == NULL); diff --git a/usr/src/uts/common/c2/audit_start.c b/usr/src/uts/common/c2/audit_start.c index 1f31d7dec9..49713c6f77 100644 --- a/usr/src/uts/common/c2/audit_start.c +++ b/usr/src/uts/common/c2/audit_start.c @@ -106,7 +106,7 @@ audit_init_module() /* generate a system-booted audit record */ au_write((caddr_t *)&rp, au_to_text("booting kernel")); - audit_async_finish((caddr_t *)&rp, AUE_SYSTEMBOOT, NULL, + audit_async_finish((caddr_t *)&rp, AUE_SYSTEMBOOT, 0, &(p0.p_user.u_start)); } |