Bug 177163

Summary: [patch] Fixing clang warnings at /sys/dev/mps
Product: Base System Reporter: Hiren Panchasara <hiren.panchasara>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Open ---    
Severity: Affects Only Me Keywords: patch
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description Hiren Panchasara 2013-03-20 22:30:00 UTC
===> mps (all)
/usr/src/sys/modules/mps/../../dev/mps/mps_mapping.c:337:6: warning: variable 'start_idx_ir' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
        if (sc->ir_firmware)
            ^~~~~~~~~~~~~~~
/usr/src/sys/modules/mps/../../dev/mps/mps_mapping.c:339:19: note: uninitialized use occurs here
        if (start_idx == start_idx_ir)
                         ^~~~~~~~~~~~
/usr/src/sys/modules/mps/../../dev/mps/mps_mapping.c:337:2: note: remove the 'if' if its condition is always true
        if (sc->ir_firmware)
        ^~~~~~~~~~~~~~~~~~~~
/usr/src/sys/modules/mps/../../dev/mps/mps_mapping.c:329:38: note: initialize the variable 'start_idx_ir' to silence this warning
        u32 start_idx, end_idx, start_idx_ir, end_idx_ir;
                                            ^
                                             = 0
1 warning generated.

Fix: 

start_idx = 0;
+       start_idx_ir = 0;
        end_idx = sc->max_devices;
        if (ioc_pg8_flags & MPI2_IOCPAGE8_FLAGS_RESERVED_TARGETID_0)
                start_idx = 1;--kwnZkcL8ssAWLWuPYo5kRhtWyef0F6hLgZqhXHMmrfNtiZsb
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

Index: sys/dev/mps/mps_mapping.c
===================================================================
--- sys/dev/mps/mps_mapping.c   (revision 248555)
+++ sys/dev/mps/mps_mapping.c   (working copy)
@@ -331,6 +331,7 @@
        u16 ioc_pg8_flags = le16toh(sc->ioc_pg8.Flags);
How-To-Repeat: cd /sys/modules/mps and do "make" to see clang warnings.
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2013-03-21 04:53:52 UTC
Responsible Changed
From-To: freebsd-bugs->eadler

I'll take it.
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2013-07-19 19:57:56 UTC
Responsible Changed
From-To: eadler->hiren

I don't have time to deal with this bug in the near future
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:34 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 4 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:40:04 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>