Bug 136235 - local variable used before set
Summary: local variable used before set
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: e2fsprogs
Version: 3
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Stephen Tweedie
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-10-18 20:20 UTC by David Binderman
Modified: 2007-11-30 22:10 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-03-10 21:38:31 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description David Binderman 2004-10-18 20:20:12 UTC
Description of problem:

I just tried to compile package e2fsprogs-1.35-11 from package
Redhat Fedora Core 3 Test 3.

The compiler said

ext2.c(421): remark #592: variable "bh2" is used before its value is set

The source code is

                struct ext2_buffer_head *bh2;
                __u32                   *udata2;
                int                      j;

                if (!udata[i]) {
                        ext2_brelse(bh, 0);
                        ext2_brelse(bh2, 0);

Suggest init bh2 before first use.


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Thomas Woerner 2004-10-19 13:21:10 UTC
This is really a problem:

void ext2_brelse(struct ext2_buffer_head *bh, int forget)
{
	if (bh->usecount-- == 1 && forget) {
		if (bh->dirty)
			ext2_bh_do_write(bh);

		ext2_bh_dealloc(bh);
	}
}


Comment 2 David Binderman 2005-03-10 10:02:22 UTC
>This is really a problem:

Is the code you provide a proposed solution ?

In any event, the original code is still broken in March 2005,
some five months later.

Comment 3 Stephen Tweedie 2005-03-10 21:38:31 UTC
The bug is real, but the code is not actually used in this package.  

That function is only used for "ext2resize" offline resizing and
"e2prepare" resize preparation.   But these days offline resize is
performed by resize2fs in upstream e2fsprogs, and e2prepare is not yet
ready for online resize; so neither binaries are actually packaged in
our e2fsprogs RPM.




Note You need to log in before you can comment on or make changes to this bug.