kern/177163: [patch] Fixing clang warnings at /sys/dev/mps

hiren panchasara hiren.panchasara at
Wed Mar 20 22:30:00 UTC 2013

>Number:         177163
>Category:       kern
>Synopsis:       [patch] Fixing clang warnings at /sys/dev/mps
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 20 22:30:00 UTC 2013
>Originator:     hiren panchasara
>Release:        current
10.0-CURRENT FreeBSD 10.0-CURRENT #1 r248555: Wed Mar 20 15:00:20 UTC 2013
===> 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.

cd /sys/modules/mps and do "make" to see clang warnings.
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);

        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;


More information about the freebsd-bugs mailing list