[Bug 279261] i2c -sv reports stack garbage in message

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 23 May 2024 20:10:51 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=279261

            Bug ID: 279261
           Summary: i2c -sv reports stack garbage in message
           Product: Base System
           Version: 15.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: jfc@mit.edu

Created attachment 250908
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=250908&action=edit
Initialize i2c_opt.addr to 0

# i2c -sv
dev: /dev/iic0, addr: 0x6cfb7d5c, r/w: r, offset: 0x00, width: 8, count: 1
Hardware may not support START/STOP scanning; trying less-reliable read method.
Scanning I2C devices on /dev/iic0:
11

# i2c -f /dev/iic1 -rv
dev: /dev/iic1, addr: 0x1903955c, r/w: r, offset: 0x00, width: 8, count: 1
Resetting I2C controller on /dev/iic1

The address 0x6cfb7d5c or 0x1903955c is an uninitialized field in variable
i2c_opt and varies from run to run.  It is not actually relevant when scanning
or resetting.

The attached patch avoids printing the "dev:" line when verbose in scan or
reset mode.  The bus name is printed elsewhere and the rest of the fields are
not relevant.  It also initializes the address to 0 just in case it gets used
somehow now or in the future.

-- 
You are receiving this mail because:
You are the assignee for the bug.