Project

General

Profile

Actions

Bug #14340

closed

libbe: 'menu_fp' may be used uninitialized

Added by Toomas Soome 8 months ago. Updated 7 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
lib - userland libraries
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:

Description

Build errors with gcc 11:

    ../common/be_utils.c: In function 'be_has_menu_entry':
    ../common/be_utils.c:2167:9: error: 'menu_fp' may be used uninitialized [-Werror=maybe-uninitialized]
     2167 |         (void) fclose(menu_fp);
          |         ^~~~~~~~~~~~~~~~~~~~~~
    ../common/be_utils.c:2070:26: note: 'menu_fp' declared here
     2070 |         FILE            *menu_fp;
          |                          ^~~~~~~
    cc1: all warnings being treated as errors

be_open_menu() can fail, possibly ending up with menu_fp not set. Also avoid double call of fclose().

Testing done: build/install/boot, beadm use cases - create/list/destroy BE, check <pool>/boot/menu.lst content is ok.

Actions #1

Updated by Toomas Soome 8 months ago

  • Description updated (diff)
Actions #2

Updated by Electric Monk 8 months ago

  • Gerrit CR set to 1896
Actions #3

Updated by Toomas Soome 7 months ago

  • Description updated (diff)
Actions #4

Updated by Electric Monk 7 months ago

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

git commit bb771288d01b795ba4ddad4a440845264a95a7e0

commit  bb771288d01b795ba4ddad4a440845264a95a7e0
Author: Toomas Soome <tsoome@me.com>
Date:   2022-01-07T16:18:39.000Z

    14340 libbe: 'menu_fp' may be used uninitialized
    Reviewed by: Andy Fiddaman <andy@omnios.org>
    Approved by: Dan McDonald <danmcd@joyent.com>

Actions

Also available in: Atom PDF