diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2020-06-16 11:55:38 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2020-06-16 11:55:38 +0000 |
commit | fdd4bc3a5b41c9614994633b599d6329a0b67f24 (patch) | |
tree | 0c7ed5962d0762f1e0f5b337b822664faca511bf | |
parent | 3d070613ff28f93fd0200a3be52a757e7816906e (diff) | |
parent | 989c147e4f8311ee853a577bac8009cc7ffc4a73 (diff) | |
download | illumos-joyent-fdd4bc3a5b41c9614994633b599d6329a0b67f24.tar.gz |
[illumos-gate merge]
commit 989c147e4f8311ee853a577bac8009cc7ffc4a73
12796 pcks11_softtoken C_GetMechanismList() should validate its arguments
commit 772852a5d3501d23ca0f77fcdbd7ddb0a25da28b
12546 pcieb: NULL pointer errors
commit ae121a1498fc4947aa90fa23f0276b59938ed62e
12571 pcisch: NULL pointer errors
-rw-r--r-- | usr/src/lib/pkcs11/pkcs11_softtoken/common/softSlotToken.c | 5 | ||||
-rw-r--r-- | usr/src/uts/sparc/io/pciex/pcieb_sparc.c | 4 | ||||
-rw-r--r-- | usr/src/uts/sun4u/io/pci/pci_counters.c | 36 | ||||
-rw-r--r-- | usr/src/uts/sun4u/io/pci/pcisch.c | 82 | ||||
-rw-r--r-- | usr/src/uts/sun4u/pcisch/Makefile | 19 |
5 files changed, 62 insertions, 84 deletions
diff --git a/usr/src/lib/pkcs11/pkcs11_softtoken/common/softSlotToken.c b/usr/src/lib/pkcs11/pkcs11_softtoken/common/softSlotToken.c index 88cf9d98da..16f98a5c1c 100644 --- a/usr/src/lib/pkcs11/pkcs11_softtoken/common/softSlotToken.c +++ b/usr/src/lib/pkcs11/pkcs11_softtoken/common/softSlotToken.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2018, Joyent, Inc. + * Copyright 2020 Joyent, Inc. */ #include <strings.h> @@ -418,6 +418,9 @@ C_GetMechanismList(CK_SLOT_ID slotID, CK_MECHANISM_TYPE_PTR pMechanismList, if (slotID != SOFTTOKEN_SLOTID) return (CKR_SLOT_ID_INVALID); + if (pulCount == NULL) + return (CKR_ARGUMENTS_BAD); + mechnum = sizeof (soft_mechanisms) / sizeof (CK_MECHANISM_TYPE); if (pMechanismList == NULL) { diff --git a/usr/src/uts/sparc/io/pciex/pcieb_sparc.c b/usr/src/uts/sparc/io/pciex/pcieb_sparc.c index bfa544d0c4..9bec9ba294 100644 --- a/usr/src/uts/sparc/io/pciex/pcieb_sparc.c +++ b/usr/src/uts/sparc/io/pciex/pcieb_sparc.c @@ -167,7 +167,7 @@ pcieb_plat_ctlops(dev_info_t *rdip, ddi_ctl_enum_t ctlop, void *arg) void pcieb_plat_initchild(dev_info_t *child) { - intptr_t ppd = NULL; + intptr_t ppd = (intptr_t)NULL; /* * XXX set ppd to 1 to disable iommu BDF protection on SPARC. * It relies on unused parent private data for PCI devices. @@ -204,7 +204,7 @@ pcieb_attach_plx_workarounds(pcieb_devstate_t *pcieb) uint8_t dev_type = bus_p->bus_dev_type; uint16_t vendor_id = bus_p->bus_dev_ven_id & 0xFFFF; uint16_t device_id = bus_p->bus_dev_ven_id >> 16; - int ce_mask = 0; + int ce_mask = 0; if (!IS_PLX_VENDORID(vendor_id)) return; diff --git a/usr/src/uts/sun4u/io/pci/pci_counters.c b/usr/src/uts/sun4u/io/pci/pci_counters.c index f284d49d33..3ad672f80d 100644 --- a/usr/src/uts/sun4u/io/pci/pci_counters.c +++ b/usr/src/uts/sun4u/io/pci/pci_counters.c @@ -24,8 +24,6 @@ * All rights reserved. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/async.h> #include <sys/sunddi.h> @@ -69,7 +67,7 @@ pci_create_name_kstat(char *name, pci_ksinfo_t *pp, pci_kev_mask_t *ev) for (i = 0; i < NUM_OF_PICS; i++) { pp->pic_name_ksp[i] = pci_create_picN_kstat(name, - i, pp->pic_shift[i], pp->pic_no_evs, ev); + i, pp->pic_shift[i], pp->pic_no_evs, ev); if (pp->pic_name_ksp[i] == NULL) { cmn_err(CE_WARN, "pci: unable to create name kstat"); @@ -97,7 +95,7 @@ pci_delete_name_kstat(pci_ksinfo_t *pp) */ static kstat_t * pci_create_picN_kstat(char *mod_name, int pic, int pic_shift, - int num_ev, pci_kev_mask_t *ev_array) + int num_ev, pci_kev_mask_t *ev_array) { struct kstat_named *pic_named_data; int inst = 0; @@ -107,9 +105,9 @@ pci_create_picN_kstat(char *mod_name, int pic, int pic_shift, (void) sprintf(pic_name, "pic%d", pic); if ((picN_ksp = kstat_create(mod_name, inst, pic_name, - "bus", KSTAT_TYPE_NAMED, num_ev, NULL)) == NULL) { + "bus", KSTAT_TYPE_NAMED, num_ev, 0)) == NULL) { cmn_err(CE_WARN, "%s %s : kstat create failed", - mod_name, pic_name); + mod_name, pic_name); /* * It is up to the calling function to delete any kstats @@ -119,8 +117,7 @@ pci_create_picN_kstat(char *mod_name, int pic, int pic_shift, return (NULL); } - pic_named_data = (struct kstat_named *) - picN_ksp->ks_data; + pic_named_data = (struct kstat_named *)picN_ksp->ks_data; /* * Write event names and their associated pcr masks. The @@ -129,22 +126,20 @@ pci_create_picN_kstat(char *mod_name, int pic, int pic_shift, */ for (event = 0; event < num_ev - 1; event++) { pic_named_data[event].value.ui64 = - (ev_array[event].pcr_mask << pic_shift); + (ev_array[event].pcr_mask << pic_shift); kstat_named_init(&pic_named_data[event], - ev_array[event].event_name, - KSTAT_DATA_UINT64); + ev_array[event].event_name, KSTAT_DATA_UINT64); } /* * add the clear_pic entry. */ pic_named_data[event].value.ui64 = - (uint64_t)~(ev_array[event].pcr_mask << pic_shift); + (uint64_t)~(ev_array[event].pcr_mask << pic_shift); kstat_named_init(&pic_named_data[event], - ev_array[event].event_name, - KSTAT_DATA_UINT64); + ev_array[event].event_name, KSTAT_DATA_UINT64); kstat_install(picN_ksp); @@ -171,27 +166,26 @@ kstat_t *pci_create_cntr_kstat(pci_t *pci_p, char *name, * also contains the %pcr */ if ((counters_ksp = kstat_create(name, drv_instance, - "counters", "bus", KSTAT_TYPE_NAMED, - num_pics + 1, - KSTAT_FLAG_WRITABLE)) == NULL) { + "counters", "bus", KSTAT_TYPE_NAMED, num_pics + 1, + KSTAT_FLAG_WRITABLE)) == NULL) { cmn_err(CE_WARN, "%s%d counters kstat_create failed", - drv_name, drv_instance); + drv_name, drv_instance); return (NULL); } counters_named_data = - (struct kstat_named *)(counters_ksp->ks_data); + (struct kstat_named *)(counters_ksp->ks_data); /* initialize the named kstats */ kstat_named_init(&counters_named_data[0], - "pcr", KSTAT_DATA_UINT64); + "pcr", KSTAT_DATA_UINT64); for (i = 0; i < num_pics; i++) { (void) sprintf(pic_str, "pic%d", i); kstat_named_init(&counters_named_data[i+1], - pic_str, KSTAT_DATA_UINT64); + pic_str, KSTAT_DATA_UINT64); } /* diff --git a/usr/src/uts/sun4u/io/pci/pcisch.c b/usr/src/uts/sun4u/io/pci/pcisch.c index 2a2bd05970..a8ffef185c 100644 --- a/usr/src/uts/sun4u/io/pci/pcisch.c +++ b/usr/src/uts/sun4u/io/pci/pcisch.c @@ -647,7 +647,7 @@ pci_intr_dist_cpuid(ib_t *ib_p, ib_ino_info_t *ino_p) void pci_cb_teardown(pci_t *pci_p) { - cb_t *cb_p = pci_p->pci_cb_p; + cb_t *cb_p = pci_p->pci_cb_p; uint32_t mondo; if (!pci_buserr_interrupt) @@ -704,7 +704,7 @@ cb_ino_to_clr_pa(cb_t *cb_p, ib_ino_t ino) */ int cb_remove_xintr(pci_t *pci_p, dev_info_t *dip, dev_info_t *rdip, ib_ino_t ino, -ib_mondo_t mondo) + ib_mondo_t mondo) { return (DDI_FAILURE); } @@ -1555,8 +1555,8 @@ pci_cb_clear_error(cb_t *cb_p, cb_errstate_t *cb_err_p) static cb_fm_err_t safari_err_tbl[] = { SAFARI_BAD_CMD, SCHIZO_CB_ELOG_BAD_CMD, CB_FATAL, SAFARI_SSM_DIS, SCHIZO_CB_ELOG_SSM_DIS, CB_FATAL, - SAFARI_BAD_CMD_PCIA, SCHIZO_CB_ELOG_BAD_CMD_PCIA, CB_FATAL, - SAFARI_BAD_CMD_PCIB, SCHIZO_CB_ELOG_BAD_CMD_PCIB, CB_FATAL, + SAFARI_BAD_CMD_PCIA, SCHIZO_CB_ELOG_BAD_CMD_PCIA, CB_FATAL, + SAFARI_BAD_CMD_PCIB, SCHIZO_CB_ELOG_BAD_CMD_PCIB, CB_FATAL, SAFARI_PAR_ERR_INT_PCIB, XMITS_CB_ELOG_PAR_ERR_INT_PCIB, CB_FATAL, SAFARI_PAR_ERR_INT_PCIA, XMITS_CB_ELOG_PAR_ERR_INT_PCIA, CB_FATAL, SAFARI_PAR_ERR_INT_SAF, XMITS_CB_ELOG_PAR_ERR_INT_SAF, CB_FATAL, @@ -1576,7 +1576,7 @@ static cb_fm_err_t safari_err_tbl[] = { SAFARI_CPU0_PAR_BIDI, SCHIZO_CB_ELOG_CPU0_PAR_BIDI, CB_FATAL, SAFARI_CPU1_PAR_SINGLE, SCHIZO_CB_ELOG_CPU1_PAR_SINGLE, CB_FATAL, SAFARI_CPU1_PAR_BIDI, SCHIZO_CB_ELOG_CPU1_PAR_BIDI, CB_FATAL, - NULL, NULL, NULL, + NULL, 0, 0, }; /* @@ -1584,7 +1584,7 @@ static cb_fm_err_t safari_err_tbl[] = { */ static int safari_err_handler(dev_info_t *dip, uint64_t fme_ena, - cb_errstate_t *cb_err_p) + cb_errstate_t *cb_err_p) { int i; int fatal = 0; @@ -1665,7 +1665,7 @@ static cb_fm_err_t jbus_err_tbl[] = { JBUS_TO_EXP_ERR, TOMATILLO_CB_ELOG_TO_EXP_ERR, CB_NONFATAL, JBUS_TO_ERR, SCHIZO_CB_ELOG_TO_ERR, CB_NONFATAL, JBUS_BUS_ERR, SCHIZO_CB_ELOG_BUS_ERR, CB_NONFATAL, - NULL, NULL, NULL, + NULL, 0, 0, }; /* @@ -1791,39 +1791,39 @@ static ecc_fm_err_t ecc_err_tbl[] = { ACC_HANDLE, PCI_ECC_SEC_PIO_UE, COMMON_ECC_AFSR_E_PIO, CBNINTR_UE, - PBM_SECONDARY, NULL, NULL, ACC_HANDLE, + PBM_SECONDARY, 0, 0, ACC_HANDLE, PCI_ECC_PIO_CE, COMMON_ECC_AFSR_E_PIO, CBNINTR_CE, - PBM_PRIMARY, NULL, NULL, ACC_HANDLE, + PBM_PRIMARY, 0, 0, ACC_HANDLE, PCI_ECC_SEC_PIO_CE, COMMON_ECC_AFSR_E_PIO, CBNINTR_CE, - PBM_SECONDARY, NULL, NULL, ACC_HANDLE, + PBM_SECONDARY, 0, 0, ACC_HANDLE, PCI_ECC_DRD_UE, COMMON_ECC_AFSR_E_DRD, CBNINTR_UE, - PBM_PRIMARY, NULL, NULL, DMA_HANDLE, + PBM_PRIMARY, 0, 0, DMA_HANDLE, PCI_ECC_SEC_DRD_UE, COMMON_ECC_AFSR_E_DRD, CBNINTR_UE, - PBM_SECONDARY, NULL, NULL, DMA_HANDLE, + PBM_SECONDARY, 0, 0, DMA_HANDLE, PCI_ECC_DRD_CE, COMMON_ECC_AFSR_E_DRD, CBNINTR_CE, - PBM_PRIMARY, NULL, NULL, DMA_HANDLE, + PBM_PRIMARY, 0, 0, DMA_HANDLE, PCI_ECC_SEC_DRD_CE, COMMON_ECC_AFSR_E_DRD, CBNINTR_CE, - PBM_SECONDARY, NULL, NULL, DMA_HANDLE, + PBM_SECONDARY, 0, 0, DMA_HANDLE, PCI_ECC_DWR_UE, COMMON_ECC_AFSR_E_DWR, CBNINTR_UE, - PBM_PRIMARY, NULL, NULL, DMA_HANDLE, + PBM_PRIMARY, 0, 0, DMA_HANDLE, PCI_ECC_SEC_DWR_UE, COMMON_ECC_AFSR_E_DWR, CBNINTR_UE, - PBM_SECONDARY, NULL, NULL, DMA_HANDLE, + PBM_SECONDARY, 0, 0, DMA_HANDLE, PCI_ECC_DWR_CE, COMMON_ECC_AFSR_E_DWR, CBNINTR_CE, - PBM_PRIMARY, NULL, NULL, DMA_HANDLE, + PBM_PRIMARY, 0, 0, DMA_HANDLE, PCI_ECC_SEC_DWR_CE, COMMON_ECC_AFSR_E_DWR, CBNINTR_CE, - PBM_SECONDARY, NULL, NULL, DMA_HANDLE, + PBM_SECONDARY, 0, 0, DMA_HANDLE, - NULL, NULL, NULL, NULL, NULL, NULL, + NULL, 0, 0, 0, 0, 0, }; /* @@ -1919,8 +1919,8 @@ pcix_err_tbl_t pcix_split_errs_tbl[] = { * Tables for the PCI-X error status messages */ pcix_err_msg_rec_t pcix_stat_errs[] = { - {XMITS_PCIX_STAT_SC_DSCRD, "pcix", "discard" }, - {XMITS_PCIX_STAT_SC_TTO, "xmits.pbmx", "tato" }, + {XMITS_PCIX_STAT_SC_DSCRD, "pcix", "discard" }, + {XMITS_PCIX_STAT_SC_TTO, "xmits.pbmx", "tato" }, {XMITS_PCIX_STAT_SMMU, "xmits.pbmx", "stmmu" }, {XMITS_PCIX_STAT_SDSTAT, "xmits.pbmx", "stdst" }, {XMITS_PCIX_STAT_CMMU, "xmits.pbmx", "cnmmu" }, @@ -1942,7 +1942,7 @@ pcix_err_tbl_t pcix_stat_errs_tbl = */ static int pcix_lookup_err_msgs(dev_info_t *dip, uint64_t ena, pcix_err_tbl_t t, - pbm_errstate_t *pbm_err_p) + pbm_errstate_t *pbm_err_p) { uint32_t err_bits = pbm_err_p->pbm_err & XMITS_PCIX_MSG_INDEX_MASK; int nerr = 0; @@ -2093,8 +2093,8 @@ static pbm_fm_err_t pbm_err_tbl[] = { PCI_SEC_SCH_BUS_UNUSABLE_ERR, SCHIZO_PCI_AFSR_E_UNUSABLE, PBM_SECONDARY, FM_LOG_PBM, NULL, - NULL, NULL, NULL, - NULL, NULL, + NULL, 0, 0, + 0, NULL, }; @@ -2283,16 +2283,16 @@ pci_check_error(pci_t *pci_p) static pbm_fm_err_t pci_pbm_err_tbl[] = { PCI_PBM_RETRY, SCHIZO_PCI_CTRL_PCI_RTRY_ERR, - NULL, PBM_NONFATAL, PCI_PBM_TARG_RETRY, + 0, PBM_NONFATAL, PCI_PBM_TARG_RETRY, PCI_PBM_TTO, SCHIZO_PCI_CTRL_PCI_TTO_ERR, - NULL, PBM_NONFATAL, PCI_PBM_TARG_TTO, + 0, PBM_NONFATAL, PCI_PBM_TARG_TTO, PCI_SCH_BUS_UNUSABLE_ERR, SCHIZO_PCI_CTRL_BUS_UNUSABLE, - NULL, PBM_NONFATAL, NULL, + 0, PBM_NONFATAL, NULL, - NULL, NULL, - NULL, NULL, NULL + NULL, 0, + 0, 0, NULL }; /* @@ -2303,7 +2303,7 @@ static pbm_fm_err_t pci_pbm_err_tbl[] = { */ int pci_pbm_err_handler(dev_info_t *dip, ddi_fm_error_t *derr, - const void *impl_data, int caller) + const void *impl_data, int caller) { int fatal = 0; int nonfatal = 0; @@ -2731,15 +2731,15 @@ pci_format_addr(dev_info_t *dip, uint64_t *afar, uint64_t afsr) } static ecc_format_t ecc_format_tbl[] = { - SCH_REG_UPA, NULL, NULL, + SCH_REG_UPA, 0, 0, SCH_REG_PCIA_REG, SCHIZO_PCI_AFSR_CONF_SPACE, PCI_SIDEA, SCH_REG_PCIA_MEM, SCHIZO_PCI_AFSR_MEM_SPACE, PCI_SIDEA, SCH_REG_PCIA_CFGIO, SCHIZO_PCI_AFSR_IO_SPACE, PCI_SIDEA, SCH_REG_PCIB_REG, SCHIZO_PCI_AFSR_CONF_SPACE, PCI_SIDEB, SCH_REG_PCIB_MEM, SCHIZO_PCI_AFSR_MEM_SPACE, PCI_SIDEB, SCH_REG_PCIB_CFGIO, SCHIZO_PCI_AFSR_IO_SPACE, PCI_SIDEB, - SCH_REG_SAFARI_REGS, NULL, NULL, - NULL, NULL, NULL, + SCH_REG_SAFARI_REGS, 0, 0, + 0, 0, 0, }; /* @@ -2773,7 +2773,7 @@ pci_format_ecc_addr(dev_info_t *dip, uint64_t *afar, ecc_region_t region) schizo_base = pa - PBM_CTRL_OFFSET; - for (i = 0; ecc_format_tbl[i].ecc_region != NULL; i++) { + for (i = 0; ecc_format_tbl[i].ecc_region != 0; i++) { if (region == ecc_format_tbl[i].ecc_region) { flag = ecc_format_tbl[i].ecc_space; if (ecc_format_tbl[i].ecc_side != pci_side) @@ -3084,11 +3084,11 @@ schizo_saf_events[] = { {"saf_bus_cycles", 0x1}, {"saf_pause_asserted_cycles", 0x2}, {"saf_frn_coherent_cmds", 0x3}, {"saf_frn_coherent_hits", 0x4}, {"saf_my_coherent_cmds", 0x5}, {"saf_my_coherent_hits", 0x6}, - {"saf_frn_io_cmds", 0x7}, {"saf_frn_io_hits", 0x8}, - {"merge_buffer", 0x9}, {"interrupts", 0xa}, - {"csr_pios", 0xc}, {"upa_pios", 0xd}, - {"pcia_pios", 0xe}, {"pcib_pios", 0xf}, - {"saf_pause_seen_cycles", 0x11}, {"dvma_reads", 0x12}, + {"saf_frn_io_cmds", 0x7}, {"saf_frn_io_hits", 0x8}, + {"merge_buffer", 0x9}, {"interrupts", 0xa}, + {"csr_pios", 0xc}, {"upa_pios", 0xd}, + {"pcia_pios", 0xe}, {"pcib_pios", 0xf}, + {"saf_pause_seen_cycles", 0x11}, {"dvma_reads", 0x12}, {"dvma_writes", 0x13}, {"saf_orq_full_cycles", 0x14}, {"saf_data_in_cycles", 0x15}, {"saf_data_out_cycles", 0x16}, {"clear_pic", 0x1f} @@ -3100,7 +3100,7 @@ schizo_saf_events[] = { */ pci_kev_mask_t schizo_pci_events[] = { - {"dvma_stream_rd", 0x0}, {"dvma_stream_wr", 0x1}, + {"dvma_stream_rd", 0x0}, {"dvma_stream_wr", 0x1}, {"dvma_const_rd", 0x2}, {"dvma_const_wr", 0x3}, {"dvma_stream_buf_mis", 0x4}, {"dvma_cycles", 0x5}, {"dvma_wd_xfr", 0x6}, {"pio_cycles", 0x7}, @@ -3578,7 +3578,7 @@ pci_reloc_getkey(void) static void tm_vmem_free(ddi_dma_impl_t *mp, iommu_t *iommu_p, dvma_addr_t dvma_pg, - int npages) + int npages) { uint32_t dur_max, dur_base; dvma_unbind_req_t *req_p, *req_max_p; diff --git a/usr/src/uts/sun4u/pcisch/Makefile b/usr/src/uts/sun4u/pcisch/Makefile index dbfb75fb27..50414236bf 100644 --- a/usr/src/uts/sun4u/pcisch/Makefile +++ b/usr/src/uts/sun4u/pcisch/Makefile @@ -40,7 +40,6 @@ UTSBASE = ../.. # MODULE = pcisch OBJECTS = $(SCHIZO_PCI_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(SCHIZO_PCI_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE) # @@ -52,7 +51,6 @@ include $(UTSBASE)/sun4u/Makefile.sun4u # Define targets # ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # @@ -65,17 +63,6 @@ CFLAGS += $(CCVERBOSE) # CFLAGS += -dalign -# -# For now, disable these lint checks; maintainers should endeavor -# to investigate and remove these for maximum lint coverage. -# Please do not carry these forward to new Makefiles. -# -LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON -LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW -LINTTAGS += -erroff=E_STATIC_UNUSED - CERRWARN += -_gcc=-Wno-parentheses CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-unused-function @@ -94,12 +81,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) # |