X-Git-Url: http://git.ozlabs.org/?p=yaboot.git;a=blobdiff_plain;f=second%2Ffs_reiserfs.c;h=a312ced0d9efff213ea18a391e7d812c94690022;hp=4b83a7aa1c26070f072574258a26626f520053d6;hb=94b9f91a346ceed386faf284ad2e549922a1a385;hpb=1f0f86b8e9cb113674bec055c2d0f182a28a5bd2 diff --git a/second/fs_reiserfs.c b/second/fs_reiserfs.c index 4b83a7a..a312ced 100644 --- a/second/fs_reiserfs.c +++ b/second/fs_reiserfs.c @@ -156,7 +156,7 @@ reiserfs_close( struct boot_file_t *file ) static __inline__ __u32 -log2( __u32 word ) +reiserfs_log2( __u32 word ) { int i = 0; while( word && (word & (1 << ++i)) == 0 ); @@ -213,12 +213,12 @@ block_read( __u32 blockNr, __u32 start, __u32 len, char *buffer ) while ( transactions-- > 0 ) { int i = 0; - int j_len; + int j_len = 0; if ( *journal_table != 0xffffffff ) { /* Search for the blockNr in cached journal */ - j_len = le32_to_cpu(*journal_table++); + j_len = le32_to_cpu((*journal_table)++); while ( i++ < j_len ) { if ( le32_to_cpu(*journal_table++) == blockNr ) @@ -428,7 +428,7 @@ reiserfs_read_super( void ) INFO->version = le16_to_cpu(super.s_version); INFO->blocksize = le16_to_cpu(super.s_blocksize); - INFO->blocksize_shift = log2( INFO->blocksize ); + INFO->blocksize_shift = reiserfs_log2( INFO->blocksize ); INFO->journal_block = le32_to_cpu(super.s_journal_block); INFO->journal_block_count = le32_to_cpu(super.s_orig_journal_size); @@ -618,7 +618,10 @@ next_key( void ) cache = CACHE( depth ); else { - cache = read_tree_node( INFO->blocks[depth], --depth ); + /* Save depth as using it twice as args to read_tree_node() + * has undefined behaviour */ + __u16 d = depth; + cache = read_tree_node( INFO->blocks[d], --depth ); if ( !cache ) return 0; }