Project

General

Profile

Actions

Bug #13809

closed

cpio: variable may be used uninitialized

Added by Toomas Soome about 2 years ago. Updated almost 2 years 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 with gcc compilers:

    cpio.c: In function 'creat_tmp':
    cpio.c:2098:3: error: 'cwd' may be used uninitialized in this function [-Werror=maybe-uninitialized]
       rest_cwd(cwd);
       ^~~~~~~~~~~~~
    cpio.c: In function 'rstfiles':
    cpio.c:6320:5: error: 'orig_mask' may be used uninitialized in this function [-Werror=maybe-uninitialized]
         (void) umask(orig_mask);
         ^~~~~~~~~~~~~~~~~~~~~~~
    cpio.c: In function 'bfill':
    cpio.c:912:13: error: 'rv' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      int i = 0, rv;
                 ^~
    cpio.c: In function 'read_hdr':
    cpio.c:5997:29: error: 'tmpnull' may be used uninitialized in this function [-Werror=maybe-uninitialized]
        *(Buffr.b_out_p + Hdrsz) = tmpnull;
        ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
    cpio.c: In function 'gethdr':
    cpio.c:4949:7: error: 'attrsize' may be used uninitialized in this function [-Werror=maybe-uninitialized]
        tp += attrsize;
           ^~
    cpio.c:4719:19: error: 'hsize' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      offset = ((hsize + Pad_val) & ~Pad_val);
                ~~~~~~~^~~~~~~~~~
    In file included from cpio.c:57:0:
    cpio.c: In function 'write_hdr':
    cpio.h:141:23: error: 'cnt' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     #define FLUSH(cnt) if ((Buffr.b_end_p - Buffr.b_in_p) < cnt) bflush()
                           ^
    cpio.c:7130:6: note: 'cnt' was declared here
      int cnt, pad;
          ^~~
    cpio.c:7220:9: error: 'mode' may be used uninitialized in this function [-Werror=maybe-uninitialized]
        mode &= ~S_ISUID;
    cc1: all warnings being treated as errors

    cpio.c:9145:8: error: 'q' may be used uninitialized in this function [-Werror=ma
    ybe-uninitialized]
       if (q->bal != 0) {
           ~^~~~~
    cc1: all warnings being treated as errors

Testing done: buiƶd/install/boot some common cpio use cases (including boot archive updates).

Actions #1

Updated by Electric Monk about 2 years ago

  • Gerrit CR set to 1494
Actions #2

Updated by Toomas Soome almost 2 years ago

  • Description updated (diff)
Actions #3

Updated by Electric Monk almost 2 years ago

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

git commit 0b9a51588b7231474f7b4009cb9cad83e4db7b74

commit  0b9a51588b7231474f7b4009cb9cad83e4db7b74
Author: Toomas Soome <tsoome@me.com>
Date:   2021-06-21T18:59:40.000Z

    13809 cpio: variable may be used uninitialized
    Reviewed by: Robert Mustacchi <rm@fingolfin.org>
    Approved by: Dan McDonald <danmcd@joyent.com>

Actions

Also available in: Atom PDF