New patch to review for coreboot: b84b83a mptable: Fix 'mptable.c:1019:12: warning: ‘c’ may be used uninitialized in this function'

Sven Schnelle (svens@stackframe.org) gerrit at coreboot.org
Wed Jun 20 09:23:43 CEST 2012


Sven Schnelle (svens at stackframe.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1110

-gerrit

commit b84b83a5a1ed0eb2b4a3e3ce49559ff61f26a4a2
Author: Sven Schnelle <svens at stackframe.org>
Date:   Wed Jun 20 09:22:17 2012 +0200

    mptable: Fix 'mptable.c:1019:12: warning: ‘c’ may be used uninitialized in this function'
    
    Change-Id: Icf6968f5bcbbe28c3a2a1d6ee7c1fd0be583f182
    Signed-off-by: Sven Schnelle <svens at stackframe.org>
---
 util/mptable/mptable.c |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/util/mptable/mptable.c b/util/mptable/mptable.c
index 7c3033e..3ce2493 100644
--- a/util/mptable/mptable.c
+++ b/util/mptable/mptable.c
@@ -997,9 +997,7 @@ lookupBusType( char* name )
 static void
 busEntry( void )
 {
-    int		x;
     char	name[ 8 ];
-    char	c;
     BusEntry	entry;
 
     /* read it into local memory */
@@ -1013,12 +1011,9 @@ busEntry( void )
     printf( "\t " ); pnstr( entry.busType, 6 ); printf( "\n" );
     }
 
-    for ( x = 0; x < 6; ++x ) {
-//	if ( (c = entry.busType[ x ]) == ' ' )
-	    //break;
-	name[ x ] = c;
-    }
-    name[ x ] = '\0';
+    memset(name, '\0', sizeof(name));
+    strncpy(name, (char *)entry.busType, 6);
+
     busses[ entry.busID ] = lookupBusType( name );
     printf("\tsmp_write_bus(mc, %d, \"", entry.busID);
     pnstr( entry.busType, 6 );




More information about the coreboot mailing list