Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Mar 2013 22:23:06 GMT
From:      hiren panchasara <hiren.panchasara@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/177163: [patch] Fixing clang warnings at /sys/dev/mps
Message-ID:  <201303202223.r2KMN69R001788@red.freebsd.org>
Resent-Message-ID: <201303202230.r2KMU0ct003713@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 20 22:30:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     hiren panchasara
>Release:        current
>Organization:
>Environment:
10.0-CURRENT FreeBSD 10.0-CURRENT #1 r248555: Wed Mar 20 15:00:20 UTC 2013
>Description:
===> 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.

>How-To-Repeat:
cd /sys/modules/mps and do "make" to see clang warnings.
>Fix:
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;


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303202223.r2KMN69R001788>