Project

General

Profile

Bug #10341

uts: boot_fb_eraseline_impl() may use uninitialized variable

Added by Toomas Soome 10 months ago. Updated 10 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
kernel
Start date:
2019-02-03
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:

Description

The gcc did complain:

../../i86pc/boot/boot_fb.c:503:9: error: 'sdst' may be used uninitialized in this function [-Werror=maybe-uninitialized]

The warning by itself appears false positive, however, we can avoid such case just by setting sdst unconditionally.

History

#1

Updated by Toomas Soome 10 months ago

  • Description updated (diff)
  • Category set to kernel
  • Status changed from New to In Progress
  • Assignee set to Toomas Soome
  • % Done changed from 0 to 90
  • Difficulty changed from Medium to Bite-size
  • Tags deleted (needs-triage)
#2

Updated by Dan McDonald 10 months ago

This is an interesting case of gcc evaluating inside a loop, but being unaware of what was done outside its context, but safely in-function.

sdst being set unconditionally at first seems reckless, but since sdst is only used inside the for loop if fb_info.shadow_fb is non-NULL, it's sensible.

#3

Updated by Electric Monk 10 months ago

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

git commit a6f5e66afa6ed3ba58a8adebd9096d051e369784

commit  a6f5e66afa6ed3ba58a8adebd9096d051e369784
Author: Toomas Soome <tsoome@me.com>
Date:   2019-02-04T18:39:12.000Z

    10341 uts: boot_fb_eraseline_impl() may use uninitialized variable
    Reviewed by: Andy Stormont <astormont@racktopsystems.com>
    Reviewed by: Gergő Doma <domag02@gmail.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom PDF