summaryrefslogtreecommitdiffstats
path: root/sys/gnu
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2005-02-24 01:40:52 +0000
committersam <sam@FreeBSD.org>2005-02-24 01:40:52 +0000
commit361f2ee16db415a2b1d085dcfbe6ddc46b7d5576 (patch)
tree8620a818c0ce63578e7b1519e6042e03e284be3d /sys/gnu
parentb76bf2322a459ecd83902b451ca1fc2633d50dd3 (diff)
downloadFreeBSD-src-361f2ee16db415a2b1d085dcfbe6ddc46b7d5576.zip
FreeBSD-src-361f2ee16db415a2b1d085dcfbe6ddc46b7d5576.tar.gz
move ptr deref's to after null ptr checks
Noticed by: Coverity Prevent analysis tool
Diffstat (limited to 'sys/gnu')
-rw-r--r--sys/gnu/ext2fs/ext2_linux_balloc.c6
-rw-r--r--sys/gnu/fs/ext2fs/ext2_linux_balloc.c6
2 files changed, 8 insertions, 4 deletions
diff --git a/sys/gnu/ext2fs/ext2_linux_balloc.c b/sys/gnu/ext2fs/ext2_linux_balloc.c
index 8b43e0d..23524ca 100644
--- a/sys/gnu/ext2fs/ext2_linux_balloc.c
+++ b/sys/gnu/ext2fs/ext2_linux_balloc.c
@@ -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);
diff --git a/sys/gnu/fs/ext2fs/ext2_linux_balloc.c b/sys/gnu/fs/ext2fs/ext2_linux_balloc.c
index 8b43e0d..23524ca 100644
--- a/sys/gnu/fs/ext2fs/ext2_linux_balloc.c
+++ b/sys/gnu/fs/ext2fs/ext2_linux_balloc.c
@@ -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);
OpenPOWER on IntegriCloud