move ptr deref's to after null ptr checks
Noticed by: Coverity Prevent analysis tool
This commit is contained in:
parent
89bc9a3171
commit
87ace10fd7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=142353
@ -173,12 +173,13 @@ void ext2_free_blocks (struct mount * mp, unsigned long block,
|
||||
unsigned long i;
|
||||
int bitmap_nr;
|
||||
struct ext2_group_desc * gdp;
|
||||
struct ext2_super_block * es = sb->s_es;
|
||||
struct ext2_super_block * es;
|
||||
|
||||
if (!sb) {
|
||||
printf ("ext2_free_blocks: nonexistent device");
|
||||
return;
|
||||
}
|
||||
es = sb->s_es;
|
||||
lock_super (VFSTOEXT2(mp)->um_devvp);
|
||||
if (block < es->s_first_data_block ||
|
||||
(block + count) > es->s_blocks_count) {
|
||||
@ -257,7 +258,7 @@ int ext2_new_block (struct mount * mp, unsigned long goal,
|
||||
int i, j, k, tmp;
|
||||
int bitmap_nr;
|
||||
struct ext2_group_desc * gdp;
|
||||
struct ext2_super_block * es = sb->s_es;
|
||||
struct ext2_super_block * es;
|
||||
|
||||
#ifdef EXT2FS_DEBUG
|
||||
static int goal_hits = 0, goal_attempts = 0;
|
||||
@ -266,6 +267,7 @@ int ext2_new_block (struct mount * mp, unsigned long goal,
|
||||
printf ("ext2_new_block: nonexistent device");
|
||||
return 0;
|
||||
}
|
||||
es = sb->s_es;
|
||||
lock_super (VFSTOEXT2(mp)->um_devvp);
|
||||
|
||||
ext2_debug ("goal=%lu.\n", goal);
|
||||
|
@ -173,12 +173,13 @@ void ext2_free_blocks (struct mount * mp, unsigned long block,
|
||||
unsigned long i;
|
||||
int bitmap_nr;
|
||||
struct ext2_group_desc * gdp;
|
||||
struct ext2_super_block * es = sb->s_es;
|
||||
struct ext2_super_block * es;
|
||||
|
||||
if (!sb) {
|
||||
printf ("ext2_free_blocks: nonexistent device");
|
||||
return;
|
||||
}
|
||||
es = sb->s_es;
|
||||
lock_super (VFSTOEXT2(mp)->um_devvp);
|
||||
if (block < es->s_first_data_block ||
|
||||
(block + count) > es->s_blocks_count) {
|
||||
@ -257,7 +258,7 @@ int ext2_new_block (struct mount * mp, unsigned long goal,
|
||||
int i, j, k, tmp;
|
||||
int bitmap_nr;
|
||||
struct ext2_group_desc * gdp;
|
||||
struct ext2_super_block * es = sb->s_es;
|
||||
struct ext2_super_block * es;
|
||||
|
||||
#ifdef EXT2FS_DEBUG
|
||||
static int goal_hits = 0, goal_attempts = 0;
|
||||
@ -266,6 +267,7 @@ int ext2_new_block (struct mount * mp, unsigned long goal,
|
||||
printf ("ext2_new_block: nonexistent device");
|
||||
return 0;
|
||||
}
|
||||
es = sb->s_es;
|
||||
lock_super (VFSTOEXT2(mp)->um_devvp);
|
||||
|
||||
ext2_debug ("goal=%lu.\n", goal);
|
||||
|
Loading…
Reference in New Issue
Block a user