Project

General

Profile

Bug #12174

i86pc: variable may be used uninitialized

Added by Toomas Soome 10 days ago.

Status:
In Progress
Priority:
Normal
Assignee:
Category:
kernel
Start date:
Due date:
% Done:

90%

Estimated time:
Difficulty:
Medium
Tags:

Description

Build errors with gcc 9:

    ../../../common/xen/io/xpvd.c: In function 'xpvd_prop_op':
    ../../../common/xen/io/xpvd.c:381:3: error: 'buff' may be used uninitialized
 in this function [-Werror=maybe-uninitialized]
      381 |   bcopy(prop_str, buff, prop_len);
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../../common/xen/io/xpvd.c: In function 'i_xpvd_parse_devname':
    ../../../common/xen/io/xpvd.c:911:9: error: 'ret' may be used uninitialized 
in this function [-Werror=maybe-uninitialized]
      911 |  return (ret);
          |         ^

    ../../i86pc/cpu/generic_cpu/gcpu_mca.c: In function 'gcpu_ereport_post':
    ../../i86pc/cpu/generic_cpu/gcpu_mca.c:938:4: error: 'scr_eqep' may be used 
uninitialized in this function [-Werror=maybe-uninitialized]
      938 |    errorq_cancel(ereport_errorq, scr_eqep);
          |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../i86pc/cpu/generic_cpu/gcpu_mca.c:936:3: error: 'eqep' may be used unin
itialized in this function [-Werror=maybe-uninitialized]
      936 |   errorq_commit(ereport_errorq, eqep, ERRORQ_SYNC);
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../i86pc/cpu/generic_cpu/gcpu_mca.c: In function 'gcpu_mca_logout':
    ../../i86pc/cpu/generic_cpu/gcpu_mca.c:1931:44: error: 'pgcl' may be used un
initialized in this function [-Werror=maybe-uninitialized]
     1931 |    if (STATUS_EQV(status, pgcl->gcl_data[i].gbl_status)) {
          |                                            ^

    ../../i86pc/io/tzmon/tzmon.c: In function 'tzmon_enumerate_zone':
    ../../i86pc/io/tzmon/tzmon.c:509:11: error: 'instance' may be used uninitial
ized in this function [-Werror=maybe-uninitialized]
      509 |    (void) snprintf(taskq_name, TZ_TASKQ_NAME_LEN,
          |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      510 |        "AcpiThermalMonitor%02d", instance);
          |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    ../../i86pc/io/xsvc/xsvc.c: In function 'xsvc_ioctl_alloc_memory':
    ../../i86pc/io/xsvc/xsvc.c:600:27: error: 'usgl' may be used uninitialized i
n this function [-Werror=maybe-uninitialized]
      600 |   err = ddi_copyout(&sgl, &usgl[i], sizeof (xsvc_mloc), mode);
          |                           ^~~~~~~~
    ../../i86pc/io/xsvc/xsvc.c:591:29: error: 'usgl32' may be used uninitialized
 in this function [-Werror=maybe-uninitialized]
      591 |   err = ddi_copyout(&sgl32, &usgl32[i], sizeof (xsvc_mloc_32),
          |                             ^~~~~~~~~~

    In file included from ../../i86pc/io/pci/pci_tools.c:37:
    ../../i86pc/io/pci/pci_tools.c: In function 'pcitool_get_intr':
    ../../common/sys/pci_tools.h:178:12: error: 'num_devs_ret' may be used unini
tialized in this function [-Werror=maybe-uninitialized]
      178 |  (num_devs * sizeof (pcitool_intr_dev_t)))
          |            ^
    ../../i86pc/io/pci/pci_tools.c:281:10: note: 'num_devs_ret' was declared her
e
      281 |  uint8_t num_devs_ret;
          |          ^~~~~~~~~~~~
    ../../i86pc/io/pci/pci_tools.c: In function 'pcitool_cfg_access':
    ../../i86pc/io/pci/pci_tools.c:646:8: error: 'local_data' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      646 |        pcitool_swap_endian(local_data, size);
          |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    ../../i86pc/io/acpi/acpidev/acpidev_drv.c: In function 'acpidev_filter_device':
    ../../i86pc/io/acpi/acpidev/acpidev_drv.c:1111:9: error: 'res' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     1111 |  return (res);
          |         ^

    ../../i86pc/io/gfx_private/gfxp_segmap.c: In function 'gfxp_ddi_segmap_setup':
    ../../i86pc/io/gfx_private/gfxp_segmap.c:127:24: error: 'pfn' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      127 |   map_addr(addrp, len, ptob(pfn), 0, flags);
          |                        ^~~~~~~~~

    ../../i86pc/io/gfx_private/gfxp_fb.c: In function 'gfxp_fb_detach':
    ../../i86pc/io/gfx_private/gfxp_fb.c:285:10: error: 'error' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      285 |   return (error);
          |          ^

    ./../i86pc/io/amd_iommu/amd_iommu_acpi.c: In function 'add_deventry_info':
    ../../i86pc/io/amd_iommu/amd_iommu_acpi.c:467:11: error: 'idx' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      467 |  uint16_t idx;
          |           ^~~
    ../../i86pc/io/amd_iommu/amd_iommu_acpi.c: In function 'set_ivmd_info':
    ../../i86pc/io/amd_iommu/amd_iommu_acpi.c:694:11: error: 'idx' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      694 |  uint16_t idx;
          |           ^~~

    ../../i86pc/io/immu_dvma.c: In function 'immu_map_dvmaseg':
    ../../i86pc/io/immu_dvma.c:2674:26: error: 'rwmask' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     2674 |        PDTE_PADDR(paddr) | rwmask;
    ../../i86pc/io/immu_dvma.c:2661:9: error: 'page' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     2661 |    page = page->p_next;
          |    ~~~~~^~~~~~~~~~~~~~

    ../../i86pc/io/pci/pci_common.c: In function 'pci_common_intr_ops':
    ../../i86pc/io/pci/pci_common.c:196:8: error: 'pci_rval' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      196 |  int   pci_rval, psm_rval = PSM_FAILURE;
          |        ^~~~~~~~

    ../../i86pc/io/rootnex.c: In function 'rootnex_map_regspec':
    ../../i86pc/io/rootnex.c:1149:20: error: 'hat_acc_flags' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     1149 |   hp->ah_hat_flags = hat_acc_flags;
          |   ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
    ../../i86pc/io/rootnex.c: In function 'rootnex_need_bounce_seg':
    ../../i86pc/io/rootnex.c:2823:7: error: 'pp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     2823 |    pp = pp->p_next;
          |    ~~~^~~~~~~~~~~~
    ../../i86pc/io/rootnex.c: In function 'rootnex_get_sgl':
    ../../i86pc/io/rootnex.c:3025:7: error: 'pp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     3025 |    pp = pp->p_next;
          |    ~~~^~~~~~~~~~~~
    ../../i86pc/io/rootnex.c: In function 'rootnex_copybuf_window_boundary':
    ../../i86pc/io/rootnex.c:4409:37: error: 'pidx' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     4409 |   dma->dp_pgmap[pidx + 1].pm_cbaddr += MMU_PAGESIZE;
          |                                     ^~

    ../../i86pc/io/ioat/ioat_chan.c: In function 'ioat_ring_loop':
    ../../i86pc/io/ioat/ioat_chan.c:863:53: error: 'currpriv' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      863 |  curr->dd_next_desc = ring->cr_phys_desc + (currpriv->ip_start << 6);
          |                                             ~~~~~~~~^~~~~~~~~~

    ../../i86pc/io/cpudrv_mach.c: In function 'cpudrv_set_topspeed':
    ../../i86pc/io/cpudrv_mach.c:174:9: error: 'top_spd' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      174 |  (void) pm_update_maxpower(dip, 0, top_spd->pm_level);
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    ../../i86pc/io/amd_iommu/amd_iommu_page_tables.c: In function 'amd_iommu_destroy_pgtables':
    ../../i86pc/io/amd_iommu/amd_iommu_page_tables.c:1404:5: error: 'tear_level' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     1404 |  if (tear_level ==  AMD_IOMMU_PGTABLE_MAXLEVEL) {
          |     ^

    ../../common/io/ppm/ppm.c: In function 'ppm_ctlops':
    ../../common/io/ppm/ppm.c:835:4: error: 'domp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      835 |    ppm_lock_all(domp, reqp, result);
          |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../common/io/ppm/ppm.c: In function 'ppm_cpr_callb':
    ../../common/io/ppm/ppm.c:1405:14: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     1405 |  return (ret == DDI_SUCCESS);
          |         ~~~~~^~~~~~~~~~~~~~~

    ../../i86pc/io/dr/dr.c: In function 'dr_dev_make_list':
    ../../i86pc/io/dr/dr.c:1579:46: error: 'nunits' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     1579 |  len = sizeof (dr_common_unit_t *) * (nunits + 1);
          |                                      ~~~~~~~~^~~~

    ../../i86pc/dboot/dboot_elfload.c: In function 'dboot_elfload64':
    ../../i86pc/dboot/dboot_elfload.c:191:26: error: 'next_addr' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      191 |    (void) memset((void *)(uintptr_t)next_addr, 0,
          |                          ^~~~~~~~~~~~~~~~~~~~

    ../../common/disp/cmt.c: In function 'pg_cmt_lineage_validate':
    ../../common/disp/cmt.c:1937:45: error: 'pg_next' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     1937 |    if (PG_CMT_HW_SUSPECT(((pghw_t *)pg_next)->pghw_hw)) {
          |                                             ^~
    ../../common/disp/cmt.c:1744:12: error: 'pg' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     1744 |  pg_cmt_t *pg, *pg_next, *pg_bad, *pg_tmp, *parent;
          |            ^~

    ../../../common/util/string.c: In function 'vsnprintf':
    ../../../common/util/string.c:313:6: error: 'bs' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      313 |    c = *bs++;
          |    ~~^~~~~~~
    ../../../common/util/string.c:72:11: error: 'ul' may be used uninitialized in this function [-Werror=maybe-uninitialized]
       72 |  uint64_t ul, tmp;
          |           ^~

    /code/illumos-gate/usr/src/common/fs/hsfs.c: In function 'find':
    /code/illumos-gate/usr/src/common/fs/hsfs.c:199:8: error: 'n' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      199 |  ino_t n;
          |        ^

    /code/illumos-gate/usr/src/common/fs/ufsops.c: In function 'find':
    /code/illumos-gate/usr/src/common/fs/ufsops.c:148:8: error: 'inode' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      148 |  ino_t inode;
          |        ^~~~~

    In file included from ../../common/sys/vnode.h:58,
                     from ../../common/vm/seg.h:43,
                     from ../../common/vm/as.h:47,
                     from ../../common/vm/vm_pagelist.c:53:
    ../../common/vm/vm_pagelist.c: In function 'page_get_replacement_page':
    ../../common/sys/sdt.h:105:2: error: 'lgrp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      105 |  __dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2), \
          |  ^~~~~~~~~~~~~~~
    ../../common/vm/vm_pagelist.c:4148:11: note: 'lgrp' was declared here
     4148 |  lgrp_t  *lgrp;
          |           ^~~~
    ../../common/vm/vm_pagelist.c:4141:7: error: 'mnode' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     4141 |  int  mnode, page_mnode;
          |       ^~~~~

    ../../intel/amd64/krtld/kobj_reloc.c: In function 'do_relocate':
    ../../intel/amd64/krtld/kobj_reloc.c:266:41: error: 'symref' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      266 |       (const char *)mp->strings + symref->st_name,
          |                                   ~~~~~~^~~~~~~~~

    ../../common/os/lgrp.c: In function 'lgrp_create':
    ../../common/os/lgrp.c:876:19: error: 'lgrpid' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      876 |   lgrp_alloc_hint = lgrpid;
          |   ~~~~~~~~~~~~~~~~^~~~~~~~
    ../../common/os/lgrp.c: In function 'lgrp_mem_init':
    ../../common/os/lgrp.c:1250:12: error: 'lgrpid' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     1250 |  lgrp_id_t lgrpid;
          |            ^~~~~~
    ../../common/os/lgrp.c: In function 'lgrp_shm_policy_get':
    ../../common/os/lgrp.c:3606:15: error: 'tree' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     3606 |  policy_seg = avl_find(tree, &off, &where);
          |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../common/os/lgrp.c:3604:2: error: 'shm_locality' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     3604 |  rw_enter(&shm_locality->loc_lock, RW_READER);
          |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    ../../common/os/bp_map.c: In function 'bp_mapin_common':
    ../../common/os/bp_map.c:169:12: error: 'as' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      169 |    pfnum = hat_getpfnum(as->a_hat,
          |            ^~~~~~~~~~~~~~~~~~~~~~~
      170 |        (caddr_t)((uintptr_t)addr & MMU_PAGEMASK));
          |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../common/os/bp_map.c: In function 'bp_copy_common':
    ../../common/os/bp_map.c:357:10: error: 'as' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      357 |    pfn = hat_getpfnum(as->a_hat,
          |          ^~~~~~~~~~~~~~~~~~~~~~~
      358 |        (caddr_t)((uintptr_t)addr & PAGEMASK));
          |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    ../../common/krtld/kobj.c: In function 'bind_primary':
    ../../common/krtld/kobj.c:1215:8: error: 'shtype' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     1215 |    if (do_relocate(mp, rela, shtype, relasz/relaent,
          |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     1216 |        relaent, (Addr)mp->text) < 0)
          |        ~~~~~~~~~~~~~~~~~~~~~~~~
    ../../common/krtld/kobj.c: In function 'kobj_load_primary_module':
    ../../common/krtld/kobj.c:2121:23: error: 'dep' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     2121 |  add_dependent(mp, dep->mod_mp);
          |                    ~~~^~~~~~~~

    ../../i86pc/os/smb_dev.c: In function 'smbios_open':
    ../../i86pc/os/smb_dev.c:156:5: error: 'ep_type' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      156 |  if (ep_type == SMBIOS_ENTRY_POINT_21) {
          |     ^

    ../../i86pc/os/startup.c: In function 'kphysm_init':
    ../../common/sys/sysmacros.h:57:36: error: 'end_pfn' may be used uninitialized in this function [-Werror=maybe-uninitialized]
       57 | #define MIN(a, b) ((a) < (b) ? (a) : (b))
          |                                    ^
    ../../i86pc/os/startup.c:2620:9: note: 'end_pfn' was declared here
     2620 |  pfn_t  end_pfn;
          |         ^~~~~~~

    ../../i86pc/os/lgrpplat.c: In function 'lgrp_plat_latency_adjust':
    ../../i86pc/os/lgrpplat.c:1690:17: error: 't' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     1690 |  u_longlong_t   t;
          |                 ^
    ../../i86pc/os/lgrpplat.c: In function 'opt_get_numa_config':
    ../../i86pc/os/lgrpplat.c:3616:4: error: 'nb_cfg_reg' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     3616 |    wrmsr(MSR_AMD_NB_CFG, nb_cfg_reg);
          |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    ../../i86pc/os/mp_machdep.c: In function 'pg_plat_hw_rank':
    ../../i86pc/os/mp_machdep.c:360:5: error: 'rank2' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      360 |  if (rank1 > rank2)
          |     ^
    ../../i86pc/os/mp_machdep.c:360:5: error: 'rank1' may be used uninitialized in this function [-Werror=maybe-uninitialized]

    ../../i86pc/vm/htable.c: In function 'htable_create':
    ../../i86pc/vm/htable.c:1482:9: error: 'ht' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     1482 |  return (ht);
          |         ^

    ../../i86pc/os/fakebop.c: In function 'find_fw_table':
    ../../i86pc/os/fakebop.c:2411:29: error: 'xsdt_addr' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     2411 |   xsdt = (ACPI_TABLE_XSDT *)map_fw_table(xsdt_addr);
          |                             ^~~~~~~~~~~~~~~~~~~~~~~

    ../../i86pc/os/ddi_impl.c: In function 'kalloca':
    ../../i86pc/os/ddi_impl.c:1498:13: error: 'vmp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     1498 |  addr[-3] = (size_t)vmp;
          |             ^~~~~~~~~~~

    ../../i86pc/os/cpupm/cpupm_mach.c: In function 'cpupm_state_change':
    ../../i86pc/os/cpupm/cpupm_mach.c:656:3: error: 'state_domain' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      656 |   mutex_enter(&state_domain->pm_lock);
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../i86pc/os/cpupm/cpupm_mach.c:644:12: error: 'state_ops' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      644 |   state_ops->cpus_change(set, level);
          |   ~~~~~~~~~^~~~~~~~~~~~~

    ../../i86pc/boot/boot_console.c: In function 'bcons_init2':
    ../../i86pc/boot/boot_console.c:939:12: error: 'ttyn' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      939 |    tty_num = ttyn;
          |    ~~~~~~~~^~~~~~

    ../../intel/os/fmsmb.c: In function 'fm_smb_mc_chipinst':
    ../../intel/os/fmsmb.c:1134:2: error: 'p_strcnt' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     1134 |  smb_free_strcnt(pstypes, p_strcnt);
          |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../intel/os/fmsmb.c:1134:2: error: 'pstypes' may be used uninitialized in this function [-Werror=maybe-uninitialized]

    ../../common/os/mem_config.c: In function 'kphysm_add_memory_dynamic':
    ../../common/os/mem_config.c:481:2: error: 'kpm_pages_off' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      481 |  hat_kpm_addmem_mseg_update(seg, nkpmpgs, kpm_pages_off);
          |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../common/os/mem_config.c:354:5: error: 'rv' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      354 |  if (rv) {
          |     ^

    ../../i86pc/os/trap.c: In function 'trap':
    ../../i86pc/os/trap.c:1519:9: error: 'mstate' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     1519 |  (void) new_mstate(ct, mstate);
          |         ^~~~~~~~~~~~~~~~~~~~~~
    ../../i86pc/os/trap.c:858:24: error: 'rw' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      858 |    if (rw != S_EXEC && pr_watch_emul(rp, vaddr, rw))
          |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../i86pc/os/trap.c:474:32: error: 'errcode' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      474 |  faultcode_t pagefault(), res, errcode;
          |                                ^~~~~~~

    ../../i86pc/os/cpuid.c: In function 'cpuid_intel_getids':
    ../../i86pc/os/cpuid.c:2229:3: error: 'ncpu_per_core' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     2229 |   for (i = 1; i < ncpu_per_core; i <<= 1)
          |   ^~~

    /code/illumos-gate/usr/src/common/dis/i386/dis_tables.c: In function 'dtrace_disx86':
    /code/illumos-gate/usr/src/common/dis/i386/dis_tables.c:5939:15: error: 'dp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     5939 |  } else if (dp->it_size != 0) {
          |             ~~^~~~~~~~~
    cc1: all warnings being treated as errors

Testing done: build/install/boot

Also available in: Atom PDF