diff options
author | Toomas Soome <tsoome@me.com> | 2019-01-18 10:38:01 +0200 |
---|---|---|
committer | Toomas Soome <tsoome@me.com> | 2019-02-20 22:08:00 +0200 |
commit | 7e12ceb3ebc63aeb71e91b496032ca22ca55f660 (patch) | |
tree | a720628c8eef67512aba873033fc352faac80c8d | |
parent | 7e897d1fc847b22dc338da9a5a59dae0cd8765de (diff) | |
download | illumos-joyent-7e12ceb3ebc63aeb71e91b496032ca22ca55f660.tar.gz |
10376 uts: NULL pointer issues in genunix
Reviewed by: Andy Fiddaman <andy@omniosce.org>
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Reviewed by: John Levon <john.levon@joyent.com>
Approved by: Robert Mustacchi <rm@joyent.com>
34 files changed, 94 insertions, 105 deletions
diff --git a/usr/src/common/acl/acl_common.c b/usr/src/common/acl/acl_common.c index c6fd162099..59c2e38b82 100644 --- a/usr/src/common/acl/acl_common.c +++ b/usr/src/common/acl/acl_common.c @@ -781,9 +781,9 @@ acevals_init(acevals_t *vals, uid_t key) static void ace_list_init(ace_list_t *al, int dfacl_flag) { - acevals_init(&al->user_obj, NULL); - acevals_init(&al->group_obj, NULL); - acevals_init(&al->other_obj, NULL); + acevals_init(&al->user_obj, 0); + acevals_init(&al->group_obj, 0); + acevals_init(&al->other_obj, 0); al->numusers = 0; al->numgroups = 0; al->acl_mask = 0; diff --git a/usr/src/uts/common/disp/class.c b/usr/src/uts/common/disp/class.c index 46fbf711ba..237ecb0497 100644 --- a/usr/src/uts/common/disp/class.c +++ b/usr/src/uts/common/disp/class.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/systm.h> #include <sys/cmn_err.h> @@ -154,7 +152,7 @@ getcidbyname_locked(char *clname, id_t *cidp) ASSERT(MUTEX_HELD(&class_lock)); - if (*clname == NULL) + if (*clname == '\0') return (EINVAL); for (clp = &sclass[0]; clp < &sclass[nclass]; clp++) { diff --git a/usr/src/uts/common/fs/dnlc.c b/usr/src/uts/common/fs/dnlc.c index 0ec57ff7f7..81a5e65ae0 100644 --- a/usr/src/uts/common/fs/dnlc.c +++ b/usr/src/uts/common/fs/dnlc.c @@ -954,7 +954,7 @@ dnlc_reduce_cache(void *reduce_percent) if (dnlc_reduce_idle && (dnlc_nentries >= ncsize || reduce_percent)) { dnlc_reduce_idle = 0; if ((taskq_dispatch(system_taskq, do_dnlc_reduce_cache, - reduce_percent, TQ_NOSLEEP)) == NULL) + reduce_percent, TQ_NOSLEEP)) == (uintptr_t)NULL) dnlc_reduce_idle = 1; } } diff --git a/usr/src/uts/common/fs/swapfs/swap_vnops.c b/usr/src/uts/common/fs/swapfs/swap_vnops.c index 07d303afbb..b6c8c2cfe7 100644 --- a/usr/src/uts/common/fs/swapfs/swap_vnops.c +++ b/usr/src/uts/common/fs/swapfs/swap_vnops.c @@ -246,7 +246,7 @@ again: swap_phys_free(pvp, poff, PAGESIZE); ap->an_pvp = NULL; - ap->an_poff = NULL; + ap->an_poff = 0; hat_setmod(pp); } @@ -423,7 +423,7 @@ swap_getconpage( swap_phys_free(pvp, poff, PAGESIZE); ap->an_pvp = NULL; - ap->an_poff = NULL; + ap->an_poff = 0; hat_setmod(pp); mutex_exit(ahm); } diff --git a/usr/src/uts/common/fs/vnode.c b/usr/src/uts/common/fs/vnode.c index 0718e17f50..fc684d7900 100644 --- a/usr/src/uts/common/fs/vnode.c +++ b/usr/src/uts/common/fs/vnode.c @@ -915,7 +915,7 @@ vn_rele_async(vnode_t *vp, taskq_t *taskq) if (vp->v_count == 1) { mutex_exit(&vp->v_lock); VERIFY(taskq_dispatch(taskq, (task_func_t *)vn_rele_inactive, - vp, TQ_SLEEP) != NULL); + vp, TQ_SLEEP) != (uintptr_t)NULL); return; } VN_RELE_LOCKED(vp); diff --git a/usr/src/uts/common/inet/ip/inet_ntop.c b/usr/src/uts/common/inet/ip/inet_ntop.c index efad4fc176..c6876cc030 100644 --- a/usr/src/uts/common/inet/ip/inet_ntop.c +++ b/usr/src/uts/common/inet/ip/inet_ntop.c @@ -285,7 +285,7 @@ __inet_pton(int af, char *inp, void *outp, int compat) in6_addr_t v6addr_u; } v6buf, *v6outp; uint16_t *dbl_col = NULL; - char lastbyte = NULL; + char lastbyte = '\0'; v6outp = (union v6buf_u *)outp; @@ -333,7 +333,7 @@ __inet_pton(int af, char *inp, void *outp, int compat) } else { v6buf.v6words_u[i] = htons((uint16_t)byte); } - if (*end == NULL || i == 7) { + if (*end == '\0' || i == 7) { inp = end; break; } @@ -349,7 +349,7 @@ __inet_pton(int af, char *inp, void *outp, int compat) dbl_col = &v6buf.v6words_u[i]; if (i == 0) inp++; - } else if (*inp == NULL || *inp == ' ' || + } else if (*inp == '\0' || *inp == ' ' || *inp == '\t') { break; } else { @@ -362,12 +362,12 @@ __inet_pton(int af, char *inp, void *outp, int compat) return (0); } inp++; - if (*inp == NULL || *inp == ' ' || *inp == '\t') { + if (*inp == '\0' || *inp == ' ' || *inp == '\t') { break; } lastbyte = *inp; } - if (*inp != NULL && *inp != ' ' && *inp != '\t') { + if (*inp != '\0' && *inp != ' ' && *inp != '\t') { return (0); } /* diff --git a/usr/src/uts/common/io/pci_intr_lib.c b/usr/src/uts/common/io/pci_intr_lib.c index ec385e0583..b5a4ffd3ef 100644 --- a/usr/src/uts/common/io/pci_intr_lib.c +++ b/usr/src/uts/common/io/pci_intr_lib.c @@ -118,7 +118,7 @@ pci_get_msi_ctrl(dev_info_t *dip, int type, ushort_t *msi_ctrl, if ((PCI_CAP_LOCATE(*h, PCI_CAP_ID_MSI, caps_ptr) == DDI_SUCCESS) && (type == DDI_INTR_TYPE_MSI)) { - if ((*msi_ctrl = PCI_CAP_GET16(*h, NULL, *caps_ptr, + if ((*msi_ctrl = PCI_CAP_GET16(*h, 0, *caps_ptr, PCI_MSI_CTRL)) == PCI_CAP_EINVAL16) goto done; @@ -130,7 +130,7 @@ pci_get_msi_ctrl(dev_info_t *dip, int type, ushort_t *msi_ctrl, if ((PCI_CAP_LOCATE(*h, PCI_CAP_ID_MSI_X, caps_ptr) == DDI_SUCCESS) && (type == DDI_INTR_TYPE_MSIX)) { - if ((*msi_ctrl = PCI_CAP_GET16(*h, NULL, *caps_ptr, + if ((*msi_ctrl = PCI_CAP_GET16(*h, 0, *caps_ptr, PCI_MSIX_CTRL)) == PCI_CAP_EINVAL16) goto done; @@ -214,37 +214,35 @@ pci_msi_configure(dev_info_t *rdip, int type, int count, int inum, if (type == DDI_INTR_TYPE_MSI) { /* Set the bits to inform how many MSIs are enabled */ msi_ctrl |= ((highbit(count) -1) << PCI_MSI_MME_SHIFT); - PCI_CAP_PUT16(h, NULL, caps_ptr, PCI_MSI_CTRL, msi_ctrl); + PCI_CAP_PUT16(h, 0, caps_ptr, PCI_MSI_CTRL, msi_ctrl); DDI_INTR_NEXDBG((CE_CONT, "pci_msi_configure: msi_ctrl = %x\n", - PCI_CAP_GET16(h, NULL, caps_ptr, PCI_MSI_CTRL))); + PCI_CAP_GET16(h, 0, caps_ptr, PCI_MSI_CTRL))); /* Set the "data" and "addr" bits */ - PCI_CAP_PUT32(h, NULL, caps_ptr, PCI_MSI_ADDR_OFFSET, addr); + PCI_CAP_PUT32(h, 0, caps_ptr, PCI_MSI_ADDR_OFFSET, addr); DDI_INTR_NEXDBG((CE_CONT, "pci_msi_configure: msi_addr = %x\n", - PCI_CAP_GET32(h, NULL, caps_ptr, PCI_MSI_ADDR_OFFSET))); + PCI_CAP_GET32(h, 0, caps_ptr, PCI_MSI_ADDR_OFFSET))); if (msi_ctrl & PCI_MSI_64BIT_MASK) { - PCI_CAP_PUT32(h, NULL, caps_ptr, PCI_MSI_ADDR_OFFSET + PCI_CAP_PUT32(h, 0, caps_ptr, PCI_MSI_ADDR_OFFSET + 4, addr >> 32); DDI_INTR_NEXDBG((CE_CONT, "pci_msi_configure: upper " - "32bit msi_addr = %x\n", PCI_CAP_GET32(h, NULL, + "32bit msi_addr = %x\n", PCI_CAP_GET32(h, 0, caps_ptr, PCI_MSI_ADDR_OFFSET + 4))); - PCI_CAP_PUT16(h, NULL, caps_ptr, PCI_MSI_64BIT_DATA, - data); + PCI_CAP_PUT16(h, 0, caps_ptr, PCI_MSI_64BIT_DATA, data); DDI_INTR_NEXDBG((CE_CONT, "pci_msi_configure: msi_data " - "= %x\n", PCI_CAP_GET16(h, NULL, caps_ptr, + "= %x\n", PCI_CAP_GET16(h, 0, caps_ptr, PCI_MSI_64BIT_DATA))); } else { - PCI_CAP_PUT16(h, NULL, caps_ptr, PCI_MSI_32BIT_DATA, - data); + PCI_CAP_PUT16(h, 0, caps_ptr, PCI_MSI_32BIT_DATA, data); DDI_INTR_NEXDBG((CE_CONT, "pci_msi_configure: msi_data " - "= %x\n", PCI_CAP_GET16(h, NULL, caps_ptr, + "= %x\n", PCI_CAP_GET16(h, 0, caps_ptr, PCI_MSI_32BIT_DATA))); } } else if (type == DDI_INTR_TYPE_MSIX) { @@ -307,22 +305,20 @@ pci_msi_unconfigure(dev_info_t *rdip, int type, int inum) if (type == DDI_INTR_TYPE_MSI) { msi_ctrl &= (~PCI_MSI_MME_MASK); - PCI_CAP_PUT16(h, NULL, caps_ptr, PCI_MSI_CTRL, msi_ctrl); + PCI_CAP_PUT16(h, 0, caps_ptr, PCI_MSI_CTRL, msi_ctrl); - PCI_CAP_PUT32(h, NULL, caps_ptr, PCI_MSI_ADDR_OFFSET, 0); + PCI_CAP_PUT32(h, 0, caps_ptr, PCI_MSI_ADDR_OFFSET, 0); if (msi_ctrl & PCI_MSI_64BIT_MASK) { - PCI_CAP_PUT16(h, NULL, caps_ptr, PCI_MSI_64BIT_DATA, - 0); - PCI_CAP_PUT32(h, NULL, caps_ptr, PCI_MSI_ADDR_OFFSET + PCI_CAP_PUT16(h, 0, caps_ptr, PCI_MSI_64BIT_DATA, 0); + PCI_CAP_PUT32(h, 0, caps_ptr, PCI_MSI_ADDR_OFFSET + 4, 0); } else { - PCI_CAP_PUT16(h, NULL, caps_ptr, PCI_MSI_32BIT_DATA, - 0); + PCI_CAP_PUT16(h, 0, caps_ptr, PCI_MSI_32BIT_DATA, 0); } DDI_INTR_NEXDBG((CE_CONT, "pci_msi_unconfigure: msi_ctrl " - "= %x\n", PCI_CAP_GET16(h, NULL, caps_ptr, PCI_MSI_CTRL))); + "= %x\n", PCI_CAP_GET16(h, 0, caps_ptr, PCI_MSI_CTRL))); } else if (type == DDI_INTR_TYPE_MSIX) { uintptr_t off; @@ -411,14 +407,14 @@ pci_msi_enable_mode(dev_info_t *rdip, int type) goto finished; msi_ctrl |= PCI_MSI_ENABLE_BIT; - PCI_CAP_PUT16(cfg_hdle, NULL, caps_ptr, PCI_MSI_CTRL, msi_ctrl); + PCI_CAP_PUT16(cfg_hdle, 0, caps_ptr, PCI_MSI_CTRL, msi_ctrl); } else if (type == DDI_INTR_TYPE_MSIX) { if (msi_ctrl & PCI_MSIX_ENABLE_BIT) goto finished; msi_ctrl |= PCI_MSIX_ENABLE_BIT; - PCI_CAP_PUT16(cfg_hdle, NULL, caps_ptr, PCI_MSIX_CTRL, + PCI_CAP_PUT16(cfg_hdle, 0, caps_ptr, PCI_MSIX_CTRL, msi_ctrl); } @@ -459,14 +455,13 @@ pci_msi_disable_mode(dev_info_t *rdip, int type) if (!(msi_ctrl & PCI_MSI_ENABLE_BIT)) goto finished; msi_ctrl &= ~PCI_MSI_ENABLE_BIT; - PCI_CAP_PUT16(cfg_hdle, NULL, caps_ptr, PCI_MSI_CTRL, msi_ctrl); + PCI_CAP_PUT16(cfg_hdle, 0, caps_ptr, PCI_MSI_CTRL, msi_ctrl); } else if (type == DDI_INTR_TYPE_MSIX) { if (!(msi_ctrl & PCI_MSIX_ENABLE_BIT)) goto finished; msi_ctrl &= ~PCI_MSIX_ENABLE_BIT; - PCI_CAP_PUT16(cfg_hdle, NULL, caps_ptr, PCI_MSIX_CTRL, - msi_ctrl); + PCI_CAP_PUT16(cfg_hdle, 0, caps_ptr, PCI_MSIX_CTRL, msi_ctrl); } finished: @@ -507,13 +502,13 @@ pci_msi_set_mask(dev_info_t *rdip, int type, int inum) offset = (msi_ctrl & PCI_MSI_64BIT_MASK) ? PCI_MSI_64BIT_MASKBITS : PCI_MSI_32BIT_MASK; - if ((mask_bits = PCI_CAP_GET32(cfg_hdle, NULL, caps_ptr, + if ((mask_bits = PCI_CAP_GET32(cfg_hdle, 0, caps_ptr, offset)) == PCI_CAP_EINVAL32) goto done; mask_bits |= (1 << inum); - PCI_CAP_PUT32(cfg_hdle, NULL, caps_ptr, offset, mask_bits); + PCI_CAP_PUT32(cfg_hdle, 0, caps_ptr, offset, mask_bits); } else if (type == DDI_INTR_TYPE_MSIX) { uintptr_t off; @@ -570,13 +565,13 @@ pci_msi_clr_mask(dev_info_t *rdip, int type, int inum) offset = (msi_ctrl & PCI_MSI_64BIT_MASK) ? PCI_MSI_64BIT_MASKBITS : PCI_MSI_32BIT_MASK; - if ((mask_bits = PCI_CAP_GET32(cfg_hdle, NULL, caps_ptr, + if ((mask_bits = PCI_CAP_GET32(cfg_hdle, 0, caps_ptr, offset)) == PCI_CAP_EINVAL32) goto done; mask_bits &= ~(1 << inum); - PCI_CAP_PUT32(cfg_hdle, NULL, caps_ptr, offset, mask_bits); + PCI_CAP_PUT32(cfg_hdle, 0, caps_ptr, offset, mask_bits); } else if (type == DDI_INTR_TYPE_MSIX) { uintptr_t off; @@ -637,7 +632,7 @@ pci_msi_get_pending(dev_info_t *rdip, int type, int inum, int *pendingp) offset = (msi_ctrl & PCI_MSI_64BIT_MASK) ? PCI_MSI_64BIT_PENDING : PCI_MSI_32BIT_PENDING; - if ((pending_bits = PCI_CAP_GET32(cfg_hdle, NULL, caps_ptr, + if ((pending_bits = PCI_CAP_GET32(cfg_hdle, 0, caps_ptr, offset)) == PCI_CAP_EINVAL32) goto done; @@ -727,7 +722,7 @@ pci_msi_set_nintrs(dev_info_t *rdip, int type, int navail) if (type == DDI_INTR_TYPE_MSI) { msi_ctrl |= ((highbit(navail) -1) << PCI_MSI_MME_SHIFT); - PCI_CAP_PUT16(cfg_hdle, NULL, caps_ptr, PCI_MSI_CTRL, msi_ctrl); + PCI_CAP_PUT16(cfg_hdle, 0, caps_ptr, PCI_MSI_CTRL, msi_ctrl); } else if (type == DDI_INTR_TYPE_MSIX) { DDI_INTR_NEXDBG((CE_CONT, "pci_msi_set_nintrs: unsupported\n")); } @@ -809,7 +804,7 @@ pci_msix_init(dev_info_t *rdip) msix_p->msix_dev_attr.devacc_attr_dataorder = DDI_STRICTORDER_ACC; /* Map the entire MSI-X vector table */ - msix_p->msix_tbl_offset = PCI_CAP_GET32(cfg_hdle, NULL, caps_ptr, + msix_p->msix_tbl_offset = PCI_CAP_GET32(cfg_hdle, 0, caps_ptr, PCI_MSIX_TBL_OFFSET); if ((breg = pci_msix_bir_index[msix_p->msix_tbl_offset & @@ -870,7 +865,7 @@ pci_msix_init(dev_info_t *rdip) /* * Map in the MSI-X Pending Bit Array */ - msix_p->msix_pba_offset = PCI_CAP_GET32(cfg_hdle, NULL, caps_ptr, + msix_p->msix_pba_offset = PCI_CAP_GET32(cfg_hdle, 0, caps_ptr, PCI_MSIX_PBA_OFFSET); if ((breg = pci_msix_bir_index[msix_p->msix_pba_offset & diff --git a/usr/src/uts/common/io/ptms_conf.c b/usr/src/uts/common/io/ptms_conf.c index 16ead0e9b6..f593f5313f 100644 --- a/usr/src/uts/common/io/ptms_conf.c +++ b/usr/src/uts/common/io/ptms_conf.c @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This file contains global data and code shared between master and slave parts * of the pseudo-terminal driver. @@ -608,8 +606,8 @@ ptms_constructor(void *maddr, void *arg, int kmflags) pt->pts_rdq = NULL; pt->ptm_rdq = NULL; pt->pt_nullmsg = NULL; - pt->pt_pid = NULL; - pt->pt_minor = NULL; + pt->pt_pid = 0; + pt->pt_minor = 0; pt->pt_refcnt = 0; pt->pt_state = 0; pt->pt_zoneid = GLOBAL_ZONEID; diff --git a/usr/src/uts/common/io/stream.c b/usr/src/uts/common/io/stream.c index e9af19ca18..ec76c6e2b9 100644 --- a/usr/src/uts/common/io/stream.c +++ b/usr/src/uts/common/io/stream.c @@ -2089,7 +2089,7 @@ dup_failed: if (freezer != curthread) mutex_exit(QLOCK(q)); - STR_FTEVENT_MSG(bp, q, FTEV_GETQ, NULL); + STR_FTEVENT_MSG(bp, q, FTEV_GETQ, 0); return (bp); } @@ -2286,7 +2286,7 @@ rmvq_noenab(queue_t *q, mblk_t *mp) if (freezer != curthread) mutex_exit(QLOCK(q)); - STR_FTEVENT_MSG(mp, q, FTEV_RMVQ, NULL); + STR_FTEVENT_MSG(mp, q, FTEV_RMVQ, 0); } /* @@ -2334,7 +2334,7 @@ flushq_common(queue_t *q, int flag, int pcproto_flag) nmp = mp->b_next; mp->b_next = mp->b_prev = NULL; - STR_FTEVENT_MBLK(mp, q, FTEV_FLUSHQ, NULL); + STR_FTEVENT_MBLK(mp, q, FTEV_FLUSHQ, 0); if (pcproto_flag && (mp->b_datap->db_type == M_PCPROTO)) (void) putq(q, mp); @@ -2773,7 +2773,7 @@ putq(queue_t *q, mblk_t *bp) } } - STR_FTEVENT_MSG(bp, q, FTEV_PUTQ, NULL); + STR_FTEVENT_MSG(bp, q, FTEV_PUTQ, 0); if ((mcls > QNORM) || (canenable(q) && (q->q_flag & QWANTR || bp->b_band))) @@ -2955,7 +2955,7 @@ putbq(queue_t *q, mblk_t *bp) } } - STR_FTEVENT_MSG(bp, q, FTEV_PUTBQ, NULL); + STR_FTEVENT_MSG(bp, q, FTEV_PUTBQ, 0); if ((mcls > QNORM) || (canenable(q) && (q->q_flag & QWANTR))) qenable_locked(q); @@ -3095,7 +3095,7 @@ badord: } } - STR_FTEVENT_MSG(mp, q, FTEV_INSQ, NULL); + STR_FTEVENT_MSG(mp, q, FTEV_INSQ, 0); if (canenable(q) && (q->q_flag & QWANTR)) qenable_locked(q); diff --git a/usr/src/uts/common/ipp/ippconf.c b/usr/src/uts/common/ipp/ippconf.c index 851a0ecca0..75e880dc83 100644 --- a/usr/src/uts/common/ipp/ippconf.c +++ b/usr/src/uts/common/ipp/ippconf.c @@ -3231,7 +3231,7 @@ hash( * Make a hash value by XORing all the ascii codes in the text string. */ - for (ptr = (char *)name; *ptr != NULL; ptr++) { + for (ptr = (char *)name; *ptr != '\0'; ptr++) { val ^= *ptr; } diff --git a/usr/src/uts/common/os/dacf.c b/usr/src/uts/common/os/dacf.c index 1ab2afa986..8d4cd486d8 100644 --- a/usr/src/uts/common/os/dacf.c +++ b/usr/src/uts/common/os/dacf.c @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * DACF: device autoconfiguration support * @@ -141,7 +139,7 @@ static dacf_ds_t dacf_devspecs[] = { { "minor-nodetype", DACF_DS_MIN_NT }, { "driver-minorname", DACF_DS_DRV_MNAME }, { "device-path", DACF_DS_DEV_PATH }, - { NULL, NULL }, + { NULL, DACF_DS_ERROR }, }; mod_hash_t *posta_mntype, *posta_mname, *posta_devname; /* post-attach */ diff --git a/usr/src/uts/common/os/damap.c b/usr/src/uts/common/os/damap.c index f90c5569c4..dc219318c6 100644 --- a/usr/src/uts/common/os/damap.c +++ b/usr/src/uts/common/os/damap.c @@ -1546,7 +1546,7 @@ dam_addrset_stable_cb(void *arg) */ if ((mapp->dam_flags & DAM_SPEND) || (taskq_dispatch(system_taskq, dam_stabilize_map, mapp, - TQ_NOSLEEP | TQ_NOQUEUE) == NULL)) { + TQ_NOSLEEP | TQ_NOQUEUE) == (uintptr_t)NULL)) { DAM_INCR_STAT(mapp, dam_overrun); mapp->dam_stable_overrun++; dam_sched_timeout(dam_addrset_stable_cb, mapp, diff --git a/usr/src/uts/common/os/dumpsubr.c b/usr/src/uts/common/os/dumpsubr.c index a30f4841d7..0eb96464bf 100644 --- a/usr/src/uts/common/os/dumpsubr.c +++ b/usr/src/uts/common/os/dumpsubr.c @@ -1255,7 +1255,7 @@ dumpinit(vnode_t *vp, char *name, int justchecking) if (IS_SWAPVP(common_specvp(cvp))) error = EBUSY; else if ((error = VOP_IOCTL(cdev_vp, - DKIOCDUMPINIT, NULL, FKIOCTL, kcred, + DKIOCDUMPINIT, 0, FKIOCTL, kcred, NULL, NULL)) != 0) dumpfini(); } @@ -1300,7 +1300,7 @@ dumpfini(void) if (is_zfs && (cdev_vp = makespecvp(VTOS(dumpvp)->s_dev, VCHR)) != NULL) { if (VOP_OPEN(&cdev_vp, FREAD | FWRITE, kcred, NULL) == 0) { - (void) VOP_IOCTL(cdev_vp, DKIOCDUMPFINI, NULL, FKIOCTL, + (void) VOP_IOCTL(cdev_vp, DKIOCDUMPFINI, 0, FKIOCTL, kcred, NULL, NULL); (void) VOP_CLOSE(cdev_vp, FREAD | FWRITE, 1, 0, kcred, NULL); @@ -2888,7 +2888,7 @@ dumpsys(void) } ++dumpcfg.nhelper_used; hp->helper = FREEHELPER; - hp->taskqid = NULL; + hp->taskqid = 0; hp->ds = ds; bzero(&hp->perpage, sizeof (hp->perpage)); if (dumpcfg.clevel >= DUMP_CLEVEL_BZIP2) diff --git a/usr/src/uts/common/os/evchannels.c b/usr/src/uts/common/os/evchannels.c index f2ca732594..cef23555f6 100644 --- a/usr/src/uts/common/os/evchannels.c +++ b/usr/src/uts/common/os/evchannels.c @@ -563,7 +563,7 @@ evch_evq_destroy(evch_eventq_t *eqp) ASSERT(evch_dl_getnum(&eqp->eq_subscr) == 0); /* Kill delivery thread */ - if (eqp->eq_thrid != NULL) { + if (eqp->eq_thrid != 0) { mutex_enter(&eqp->eq_queuemx); eqp->eq_tabortflag = 1; eqp->eq_holdmode = 0; diff --git a/usr/src/uts/common/os/exec.c b/usr/src/uts/common/os/exec.c index 53c552f135..f51e2c5ca1 100644 --- a/usr/src/uts/common/os/exec.c +++ b/usr/src/uts/common/os/exec.c @@ -356,7 +356,7 @@ exec_common(const char *fname, const char **argp, const char **envp, */ up->u_acflag &= ~AFORK; bcopy(exec_file, up->u_comm, MAXCOMLEN+1); - curthread->t_predcache = NULL; + curthread->t_predcache = 0; /* * Clear contract template state @@ -1664,7 +1664,7 @@ stk_copyin(execa_t *uap, uarg_t *args, intpdata_t *intp, void **auxvpp) if (args->scrubenv && strncmp(tmp, "LD_", 3) == 0) { /* Undo the copied string */ args->stk_strp = tmp; - *(args->stk_offp++) = NULL; + *(args->stk_offp++) = 0; } envp += ptrsize; } diff --git a/usr/src/uts/common/os/main.c b/usr/src/uts/common/os/main.c index ec61ad5c76..7bc41b6954 100644 --- a/usr/src/uts/common/os/main.c +++ b/usr/src/uts/common/os/main.c @@ -277,7 +277,7 @@ exec_init(const char *initpath, const char *args) lwp->lwp_ap = lwp->lwp_arg; lwp->lwp_arg[0] = exec_fnamep; lwp->lwp_arg[1] = uap; - lwp->lwp_arg[2] = NULL; + lwp->lwp_arg[2] = 0; curthread->t_post_sys = 1; curthread->t_sysnum = SYS_execve; diff --git a/usr/src/uts/common/os/modctl.c b/usr/src/uts/common/os/modctl.c index a6392a5273..e2a3335eb4 100644 --- a/usr/src/uts/common/os/modctl.c +++ b/usr/src/uts/common/os/modctl.c @@ -2300,17 +2300,17 @@ modctl_hp(int subcmd, const char *path, char *cn_name, uintptr_t arg, switch (subcmd) { case MODHPOPS_CHANGE_STATE: error = ddihp_modctl(DDI_HPOP_CN_CHANGE_STATE, devpath, - cn_name_str, arg, NULL); + cn_name_str, arg, 0); break; case MODHPOPS_CREATE_PORT: /* Create an empty PORT */ error = ddihp_modctl(DDI_HPOP_CN_CREATE_PORT, devpath, - cn_name_str, NULL, NULL); + cn_name_str, 0, 0); break; case MODHPOPS_REMOVE_PORT: /* Remove an empty PORT */ error = ddihp_modctl(DDI_HPOP_CN_REMOVE_PORT, devpath, - cn_name_str, NULL, NULL); + cn_name_str, 0, 0); break; case MODHPOPS_BUS_GET: error = ddihp_modctl(DDI_HPOP_CN_GET_PROPERTY, devpath, diff --git a/usr/src/uts/common/os/modsysfile.c b/usr/src/uts/common/os/modsysfile.c index 7d8580c334..3605104ae7 100644 --- a/usr/src/uts/common/os/modsysfile.c +++ b/usr/src/uts/common/os/modsysfile.c @@ -1201,7 +1201,7 @@ sys_set_var(int fcn, struct sysparam *sysp, void *p) } else return; - if (symaddr != NULL) { + if (symaddr != (uintptr_t)NULL) { switch (size) { case 1: set_int8_var(symaddr, sysp); diff --git a/usr/src/uts/common/os/pcifm.c b/usr/src/uts/common/os/pcifm.c index a95686fc54..863b3a5105 100644 --- a/usr/src/uts/common/os/pcifm.c +++ b/usr/src/uts/common/os/pcifm.c @@ -49,7 +49,7 @@ pci_fm_err_t pci_err_tbl[] = { PCI_MA, PCI_STAT_R_MAST_AB, PCI_TARG_MA, DDI_FM_UNKNOWN, PCI_REC_TA, PCI_STAT_R_TARG_AB, PCI_TARG_REC_TA, DDI_FM_UNKNOWN, PCI_SIG_TA, PCI_STAT_S_TARG_AB, NULL, DDI_FM_UNKNOWN, - NULL, NULL, NULL, NULL, + NULL, 0, NULL, DDI_FM_OK, }; pci_fm_err_t pci_bdg_err_tbl[] = { @@ -61,14 +61,14 @@ pci_fm_err_t pci_bdg_err_tbl[] = { #endif PCI_REC_TA, PCI_STAT_R_TARG_AB, PCI_TARG_REC_TA, DDI_FM_UNKNOWN, PCI_SIG_TA, PCI_STAT_S_TARG_AB, NULL, DDI_FM_UNKNOWN, - NULL, NULL, NULL, NULL, + NULL, 0, NULL, DDI_FM_OK, }; static pci_fm_err_t pcix_err_tbl[] = { PCIX_SPL_DIS, PCI_PCIX_SPL_DSCD, NULL, DDI_FM_UNKNOWN, PCIX_UNEX_SPL, PCI_PCIX_UNEX_SPL, NULL, DDI_FM_UNKNOWN, PCIX_RX_SPL_MSG, PCI_PCIX_RX_SPL_MSG, NULL, DDI_FM_UNKNOWN, - NULL, NULL, NULL, NULL, + NULL, 0, NULL, DDI_FM_OK, }; static pci_fm_err_t pcix_sec_err_tbl[] = { @@ -76,7 +76,7 @@ static pci_fm_err_t pcix_sec_err_tbl[] = { PCIX_UNEX_SPL, PCI_PCIX_BSS_UNEX_SPL, NULL, DDI_FM_UNKNOWN, PCIX_BSS_SPL_OR, PCI_PCIX_BSS_SPL_OR, NULL, DDI_FM_OK, PCIX_BSS_SPL_DLY, PCI_PCIX_BSS_SPL_DLY, NULL, DDI_FM_OK, - NULL, NULL, NULL, NULL, + NULL, 0, NULL, DDI_FM_OK, }; static int @@ -1113,7 +1113,7 @@ pci_ereport_post(dev_info_t *dip, ddi_fm_error_t *derr, uint16_t *xx_status) ASSERT(fmhdl); - if (de.fme_ena == NULL) + if (de.fme_ena == 0) de.fme_ena = fm_ena_generate(0, FM_ENA_FMT1); erpt_p = (pci_erpt_t *)fmhdl->fh_bus_specific; diff --git a/usr/src/uts/common/os/policy.c b/usr/src/uts/common/os/policy.c index d6821c83b0..d3d362a8a7 100644 --- a/usr/src/uts/common/os/policy.c +++ b/usr/src/uts/common/os/policy.c @@ -2070,7 +2070,7 @@ secpolicy_rpcmod_open(const cred_t *cr) if (PRIV_POLICY_ONLY(cr, PRIV_SYS_NFS, B_FALSE)) return (secpolicy_nfs(cr)); else - return (secpolicy_net_config(cr, NULL)); + return (secpolicy_net_config(cr, B_FALSE)); } int diff --git a/usr/src/uts/common/os/pool.c b/usr/src/uts/common/os/pool.c index c79c7dad51..6d183cd71c 100644 --- a/usr/src/uts/common/os/pool.c +++ b/usr/src/uts/common/os/pool.c @@ -566,14 +566,14 @@ pool_status(int status) if (ret != 0) return (ret); pool_state = POOL_ENABLED; - pool_event_dispatch(POOL_E_ENABLE, NULL); + pool_event_dispatch(POOL_E_ENABLE, 0); break; case POOL_DISABLED: ret = pool_disable(); if (ret != 0) return (ret); pool_state = POOL_DISABLED; - pool_event_dispatch(POOL_E_DISABLE, NULL); + pool_event_dispatch(POOL_E_DISABLE, 0); break; default: ret = EINVAL; diff --git a/usr/src/uts/common/os/streamio.c b/usr/src/uts/common/os/streamio.c index 1786769cfb..d4c2f7023d 100644 --- a/usr/src/uts/common/os/streamio.c +++ b/usr/src/uts/common/os/streamio.c @@ -5469,7 +5469,7 @@ strioctl(struct vnode *vp, int cmd, intptr_t arg, int flag, int copyflag, struct str_mlist *mlist; STRUCT_DECL(str_list, strlist); - if (arg == NULL) { /* Return number of modules plus driver */ + if (arg == 0) { /* Return number of modules plus driver */ if (stp->sd_vnode->v_type == VFIFO) *rvalp = stp->sd_pushcnt; else diff --git a/usr/src/uts/common/os/strsubr.c b/usr/src/uts/common/os/strsubr.c index 99d94cccf8..c19f7cefb7 100644 --- a/usr/src/uts/common/os/strsubr.c +++ b/usr/src/uts/common/os/strsubr.c @@ -4034,7 +4034,7 @@ esballoc_enqueue_mblk(mblk_t *mp) { if (taskq_dispatch(system_taskq, (task_func_t *)esballoc_mblk_free, mp, - TQ_NOSLEEP) == NULL) { + TQ_NOSLEEP) == (uintptr_t)NULL) { mblk_t *first_mp = mp; /* * System is low on resources and can't perform a non-sleeping diff --git a/usr/src/uts/common/os/sunpci.c b/usr/src/uts/common/os/sunpci.c index b26685d941..0dd4f4c206 100644 --- a/usr/src/uts/common/os/sunpci.c +++ b/usr/src/uts/common/os/sunpci.c @@ -357,7 +357,7 @@ static pci_cap_entry_t pci_cap_table[] = { * {PCI_CAP_ID_AGP_8X, 0, NULL}, * {PCI_CAP_ID_SECURE_DEV, 0, NULL}, */ - {PCI_CAP_NEXT_PTR_NULL, 0, NULL} + {PCI_CAP_NEXT_PTR_NULL, 0, 0} }; diff --git a/usr/src/uts/common/os/task.c b/usr/src/uts/common/os/task.c index bafcfd45e0..91325429a3 100644 --- a/usr/src/uts/common/os/task.c +++ b/usr/src/uts/common/os/task.c @@ -456,7 +456,7 @@ task_rele(task_t *tk) * the task fails. */ if (taskq_dispatch(exacct_queue, exacct_commit_task, tk, - TQ_NOSLEEP | TQ_NOQUEUE) == NULL) { + TQ_NOSLEEP | TQ_NOQUEUE) == (uintptr_t)NULL) { mutex_enter(&task_commit_lock); if (task_commit_head == NULL) { task_commit_head = task_commit_tail = tk; diff --git a/usr/src/uts/common/os/taskq.c b/usr/src/uts/common/os/taskq.c index 1fe93e9735..5714831e96 100644 --- a/usr/src/uts/common/os/taskq.c +++ b/usr/src/uts/common/os/taskq.c @@ -1167,7 +1167,7 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) if ((tqe = taskq_ent_alloc(tq, flags)) == NULL) { tq->tq_nomem++; mutex_exit(&tq->tq_lock); - return (NULL); + return ((taskqid_t)tqe); } /* Make sure we start without any flags */ tqe->tqent_un.tqent_flags = 0; diff --git a/usr/src/uts/common/os/zone.c b/usr/src/uts/common/os/zone.c index e89cf2c06d..c759f7e010 100644 --- a/usr/src/uts/common/os/zone.c +++ b/usr/src/uts/common/os/zone.c @@ -3836,9 +3836,9 @@ zsched(void *arg) bcopy("zsched", PTOU(pp)->u_psargs, sizeof ("zsched")); bcopy("zsched", PTOU(pp)->u_comm, sizeof ("zsched")); PTOU(pp)->u_argc = 0; - PTOU(pp)->u_argv = NULL; - PTOU(pp)->u_envp = NULL; - PTOU(pp)->u_commpagep = NULL; + PTOU(pp)->u_argv = 0; + PTOU(pp)->u_envp = 0; + PTOU(pp)->u_commpagep = 0; closeall(P_FINFO(pp)); /* diff --git a/usr/src/uts/common/syscall/lgrpsys.c b/usr/src/uts/common/syscall/lgrpsys.c index be60d1a445..34bd08fd12 100644 --- a/usr/src/uts/common/syscall/lgrpsys.c +++ b/usr/src/uts/common/syscall/lgrpsys.c @@ -182,7 +182,7 @@ meminfo(int addr_count, struct meminfo *mip) out_array[i] = lgrp->lgrp_id; val_array[i] = VALID_ADDR | VALID_REQ; } else { - out_array[i] = NULL; + out_array[i] = 0; val_array[i] = 0; } } @@ -1857,7 +1857,7 @@ lgrp_snapshot_copy32(caddr32_t buf, size32_t bufsize) snap_size = snap_hdr_size + info_size + cpuids_size + bitmasks_size + lats_size; - if (buf == NULL || bufsize <= 0) { + if (buf == 0 || bufsize <= 0) { return (snap_size); } diff --git a/usr/src/uts/common/syscall/lwp_create.c b/usr/src/uts/common/syscall/lwp_create.c index 53ecd8c5e2..361654cabb 100644 --- a/usr/src/uts/common/syscall/lwp_create.c +++ b/usr/src/uts/common/syscall/lwp_create.c @@ -126,7 +126,7 @@ syslwp_create(ucontext_t *ucp, int flags, id_t *new_lwp) mutex_enter(&curproc->p_lock); pool_barrier_enter(); mutex_exit(&curproc->p_lock); - lwp = lwp_create(lwp_rtt, NULL, NULL, curproc, TS_STOPPED, + lwp = lwp_create(lwp_rtt, NULL, 0, curproc, TS_STOPPED, curthread->t_pri, &sigmask, curthread->t_cid, 0); mutex_enter(&curproc->p_lock); pool_barrier_exit(); diff --git a/usr/src/uts/common/syscall/poll.c b/usr/src/uts/common/syscall/poll.c index 6ffef9e3ec..ae34556f14 100644 --- a/usr/src/uts/common/syscall/poll.c +++ b/usr/src/uts/common/syscall/poll.c @@ -499,12 +499,12 @@ poll_common(pollfd_t *fds, nfds_t nfds, timespec_t *tsp, k_sigset_t *ksetp) /* * Note that pcs_usradr field of an used entry won't be - * NULL because it stores the address of passed-in fds, - * and NULL fds will not be cached (Then it is either + * 0 because it stores the address of passed-in fds, + * and 0 fds will not be cached (Then it is either * the special timeout case when nfds is 0 or it returns * failure directly). */ - if (pcset[cacheindex].pcs_usradr == NULL) { + if (pcset[cacheindex].pcs_usradr == (uintptr_t)NULL) { /* * found an unused entry. Use it to cache * this poll list. @@ -2178,7 +2178,7 @@ pcacheset_cache_list(pollstate_t *ps, pollfd_t *fds, int *fdcntp, int which) pcacheset_remove_list(ps, pollfdp, 0, i, which, 0); kmem_free(newfdlist, ps->ps_nfds * sizeof (pollfd_t)); pcacheset[which].pcs_pollfd = NULL; - pcacheset[which].pcs_usradr = NULL; + pcacheset[which].pcs_usradr = (uintptr_t)NULL; break; } } diff --git a/usr/src/uts/common/syscall/uadmin.c b/usr/src/uts/common/syscall/uadmin.c index 3f261fcda4..858305504d 100644 --- a/usr/src/uts/common/syscall/uadmin.c +++ b/usr/src/uts/common/syscall/uadmin.c @@ -280,7 +280,7 @@ kadmin(int cmd, int fcn, void *mdep, cred_t *credp) * vfs_syncall() can acquire the vfs locks they need. */ sema_p(&fsflush_sema); - (void) callb_execute_class(CB_CL_UADMIN_PRE_VFS, NULL); + (void) callb_execute_class(CB_CL_UADMIN_PRE_VFS, 0); vfs_unmountall(); (void) VFS_MOUNTROOT(rootvfs, ROOT_UNMOUNT); @@ -442,7 +442,7 @@ uadmin(int cmd, int fcn, uintptr_t mdep) * Certain subcommands intepret a non-NULL mdep value as a pointer to * a boot string. We pull that in as bootargs, if applicable. */ - if (mdep != NULL && + if (mdep != (uintptr_t)NULL && (cmd == A_SHUTDOWN || cmd == A_REBOOT || cmd == A_DUMP || cmd == A_FREEZE || cmd == A_CONFIG)) { bootargs = kmem_zalloc(BOOTARGS_MAX, KM_SLEEP); diff --git a/usr/src/uts/common/vm/hat_refmod.c b/usr/src/uts/common/vm/hat_refmod.c index ad15becea4..31a85d4cf6 100644 --- a/usr/src/uts/common/vm/hat_refmod.c +++ b/usr/src/uts/common/vm/hat_refmod.c @@ -230,7 +230,7 @@ hat_freestat(struct as *as, int id) mutex_enter(&hat_statlock); for (prev_ahrm = NULL; hrm; hrm = hrm->hrm_anext) { - if ((id == hrm->hrm_id) || (id == NULL)) { + if ((id == hrm->hrm_id) || (id == 0)) { hrm_hashout(hrm); hrm->hrm_hnext = hrm_blist; diff --git a/usr/src/uts/common/vm/seg_kp.c b/usr/src/uts/common/vm/seg_kp.c index d33ff004f1..02c844bff6 100644 --- a/usr/src/uts/common/vm/seg_kp.c +++ b/usr/src/uts/common/vm/seg_kp.c @@ -1357,7 +1357,7 @@ swapsize(caddr_t v) if ((kpd = segkp_find(segkp, v)) != NULL) return (SEGKP_MAPLEN(kpd->kp_len, kpd->kp_flags)); else - return (NULL); + return (0); } /* diff --git a/usr/src/uts/intel/ia32/syscall/getcontext.c b/usr/src/uts/intel/ia32/syscall/getcontext.c index cb5a5b52ba..d5dfd5a9cd 100644 --- a/usr/src/uts/intel/ia32/syscall/getcontext.c +++ b/usr/src/uts/intel/ia32/syscall/getcontext.c @@ -74,7 +74,7 @@ savecontext(ucontext_t *ucp, const k_sigset_t *mask) * been disabled for this LWP. If stack bounds checking is disabled * or the copyin() fails, we fall back to the legacy behavior. */ - if (lwp->lwp_ustack == NULL || + if (lwp->lwp_ustack == (uintptr_t)NULL || copyin((void *)lwp->lwp_ustack, &ucp->uc_stack, sizeof (ucp->uc_stack)) != 0 || ucp->uc_stack.ss_size == 0) { @@ -266,7 +266,7 @@ savecontext32(ucontext32_t *ucp, const k_sigset_t *mask) ucp->uc_flags = UC_ALL; ucp->uc_link = (caddr32_t)lwp->lwp_oldcontext; - if (lwp->lwp_ustack == NULL || + if (lwp->lwp_ustack == (uintptr_t)NULL || copyin((void *)lwp->lwp_ustack, &ucp->uc_stack, sizeof (ucp->uc_stack)) != 0 || ucp->uc_stack.ss_size == 0) { |