Project

General

Profile

Actions

Bug #13806

closed

dladm: variable may be used uninitialized

Added by Toomas Soome about 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
cmd - userland programs
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
External Bug:

Description

Build errors from gcc compilers:

    dladm.c: In function 'do_show_bridge':
    dladm.c:8723:8: error: 'field_arr' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      oferr = ofmt_open(fields_str, field_arr, ofmtflags, 0, &ofmt);
      ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    dladm.c:8723:8: error: 'all_str' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    dladm.c: In function 'get_secobj_val':
    dladm.c:7169:10: error: 'len' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      return (convert_secobj(buf, len, obj_val, obj_lenp, class));
             ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    dladm.c: In function 'print_link':
    dladm.c:2846:3: error: 'mtu' may be used uninitialized in this function [-Werror=maybe-uninitialized]
       (void) snprintf(lbuf->link_mtu, sizeof (lbuf->link_mtu),
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           "%u", mtu);
           ~~~~~~~~~~
    cc1: all warnings being treated as errors

    dladm.c: In function 'print_aggr_stats_cb':
    dladm.c:3260:26: error: 'diff_stats' may be used uninitialized in this function [-Werror=maybe-uninitialized]
            (double)diff_stats->opackets/
                    ~~~~~~~~~~^~~~~~~~~~
    dladm.c: In function 'print_xaggr_cb':
    dladm.c:3045:11: error: 'portp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
        (void) dladm_aggr_portstate2str(portp->lp_state,
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            tmpbuf);
            ~~~~~~~
    cc1: all warnings being treated as errors
    *** Error code 1
    dmake: Fatal error: Command failed for target `dladm.o'
    Current working directory /code/illumos-gate/usr/src/cmd/dladm

Testing done: dladm show-link, show-aggr, show-bridge appears to work as expected.

Actions #1

Updated by Electric Monk about 2 years ago

  • Gerrit CR set to 1491
Actions #2

Updated by Toomas Soome over 1 year ago

  • Description updated (diff)
Actions #3

Updated by Electric Monk over 1 year ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100

git commit f3ac7507d50b5ba3cf8e8f10d10cedc91620ed29

commit  f3ac7507d50b5ba3cf8e8f10d10cedc91620ed29
Author: Toomas Soome <tsoome@me.com>
Date:   2021-11-01T06:12:16.000Z

    13806 dladm: variable may be used uninitialized
    Reviewed by: Robert Mustacchi <rm+illumos@fingolfin.org>
    Approved by: Rich Lowe <richlowe@richlowe.net>

Actions

Also available in: Atom PDF