Project

General

Profile

Actions

Bug #13401

closed

eeprom: 'lv' may be used uninitialized in this function

Added by Toomas Soome over 1 year ago. Updated over 1 year ago.

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

100%

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

Description

Build error with gcc 10:

    benv.c: In function 'add_pair':
    benv.c:754:22: error: 'lv' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      754 |   if (lv < INT16_MIN || lv > INT16_MAX)
    cc1: all warnings being treated as errors

Typo created by me. Compiler gags are bad.

Testing one:

root@test:/home/tsoome# eeprom -b -n illumos:nvstore -k test -t DATA_TYPE_INT16 -v 32768
error: Invalid argument
root@test:/home/tsoome# eeprom -b -n illumos:nvstore -k test -t DATA_TYPE_INT16 -v 32767
zfs bootenv is successfully written
root@test:/home/tsoome# 
root@test:/home/tsoome# eeprom -bp
nvlist version: 0
    version = 0x1
    illumos:nvstore = (embedded nvlist)
    nvlist version: 0
        help = not now
        test = 32767
    (end illumos:nvstore)

root@test:/home/tsoome# eeprom -b -n illumos:nvstore -k test -t DATA_TYPE_INT16 -v 32768
error: Invalid argument
root@test:/home/tsoome# eeprom -b -n illumos:nvstore -k test -t DATA_TYPE_INT16 -v -32768
zfs bootenv is successfully written
root@test:/home/tsoome# eeprom -b -n illumos:nvstore -k test -t DATA_TYPE_INT16 -v -32769
error: Invalid argument
root@test:/home/tsoome# eeprom -bp
nvlist version: 0
    version = 0x1
    illumos:nvstore = (embedded nvlist)
    nvlist version: 0
        help = not now
        test = -32768
    (end illumos:nvstore)

Actions #1

Updated by Electric Monk over 1 year ago

  • Gerrit CR set to 1125
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 f816551bb187d104fbf2757703d7a5d2189a3a18

commit  f816551bb187d104fbf2757703d7a5d2189a3a18
Author: Toomas Soome <tsoome@me.com>
Date:   2020-12-29T19:13:10.000Z

    13401 eeprom: 'lv' may be used uninitialized in this function
    Reviewed by: Gergő Mihály Doma <domag02@gmail.com>
    Reviewed by: Andrew Stormont <andyjstormont@gmail.com>
    Reviewed by: Andy Fiddaman <andy@omnios.org>
    Approved by: Robert Mustacchi <rm@fingolfin.org>

Actions

Also available in: Atom PDF