Project

General

Profile

Actions

Bug #10688

closed

gfx_private needs smatch fixes

Added by John Levon about 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
driver - device drivers
Start date:
2019-04-03
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
smatch
Gerrit CR:

Description

Quieten smatch complaints for i86pc/gfx_private

Actions #1

Updated by John Levon about 2 years ago

  • Tags changed from needs-triage to needs-triage smatch
Actions #2

Updated by Toomas Soome about 2 years ago

  • Category set to driver - device drivers
  • Assignee changed from John Levon to Toomas Soome
  • % Done changed from 0 to 90
  • Tags changed from needs-triage smatch to smatch

smatch is reporting errors:

/code/illumos-gate/usr/src/tools/proto/root_i386-nd/opt/onbld/bin/i386/smatch: ../../i86pc/io/gfx_private/gfxp_bitmap.c:193 bitmap_kdsetmode() error: unchecked function return 'softc->blt_ops.setmode'
/code/illumos-gate/usr/src/tools/proto/root_i386-nd/opt/onbld/bin/i386/smatch: ../../i86pc/io/gfx_private/gfxp_bitmap.c:199 bitmap_kdsetmode() error: unchecked function return 'softc->blt_ops.setmode'
/code/illumos-gate/usr/src/tools/proto/root_i386-nd/opt/onbld/bin/i386/smatch: ../../i86pc/io/gfx_private/gfxp_bitmap.c:673 bitmap_devmap() warn: variable dereferenced before check 'softc' (see line 670)
/code/illumos-gate/usr/src/tools/proto/root_i386-nd/opt/onbld/bin/i386/smatch: ../../i86pc/io/gfx_private/gfxp_vgatext.c:398 vgatext_kdsetmode() error: unchecked function return 'softc->blt_ops.setmode'
/code/illumos-gate/usr/src/tools/proto/root_i386-nd/opt/onbld/bin/i386/smatch: ../../i86pc/io/gfx_private/gfxp_vgatext.c:405 vgatext_kdsetmode() error: unchecked function return 'softc->blt_ops.setmode'

We need to check the return value from setmode() callback, non-zero value is error, but we have no indication what error exactly.
In case of error we should not continue with mode change.

Variable dereferenced before check 'softc' is plain bug.

Actions #3

Updated by Toomas Soome about 2 years ago

  • Status changed from New to In Progress
Actions #4

Updated by Electric Monk about 2 years ago

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

git commit ceedf1248cb119d3359e4da0775d4d136b298408

commit  ceedf1248cb119d3359e4da0775d4d136b298408
Author: Toomas Soome <tsoome@me.com>
Date:   2019-04-19T21:09:17.000Z

    10688 gfx_private needs smatch fixes
    Reviewed by: Andy Stormont <astormont@racktopsystems.com>
    Reviewed by: Gergő Doma <domag02@gmail.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Actions

Also available in: Atom PDF