[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 5/8] mach-defpager: fix warning about uninitialized variable
From: |
Justus Winter |
Subject: |
[PATCH 5/8] mach-defpager: fix warning about uninitialized variable |
Date: |
Wed, 12 Mar 2014 15:55:51 +0100 |
Previously, failure to look up the given partition was detected after
the loop by checking whether the loop ran over all existing
partitions. Initialize part to NULL and check for that instead. This
retains the behavior, but expresses it in a way the compiler
understands better.
* mach-defpager/default_pager.c (destroy_paging_partition): Initialize
part to NULL and check for it still being NULL after the loop.
---
mach-defpager/default_pager.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mach-defpager/default_pager.c b/mach-defpager/default_pager.c
index 33d72b3..1b9d511 100644
--- a/mach-defpager/default_pager.c
+++ b/mach-defpager/default_pager.c
@@ -1991,7 +1991,7 @@ destroy_paging_partition(name, pp_private)
void **pp_private;
{
unsigned int id = part_id(name);
- partition_t part;
+ partition_t part = NULL;
boolean_t all_ok = TRUE;
default_pager_t entry;
int pindex;
@@ -2006,7 +2006,7 @@ destroy_paging_partition(name, pp_private)
part = partition_of(pindex);
if (part && (part->id == id)) break;
}
- if (pindex == all_partitions.n_partitions) {
+ if (! part) {
pthread_mutex_unlock(&all_partitions.lock);
return KERN_INVALID_ARGUMENT;
}
--
1.9.0
- [PATCH 1/8] mach-defpager: remove comments around form feeds, Justus Winter, 2014/03/12
- [PATCH 3/8] mach-defpager: add and use synchronized_printf for dprintf, Justus Winter, 2014/03/12
- [PATCH 4/8] mach-defpager: fix error handling in S_default_pager_object_set_size, Justus Winter, 2014/03/12
- [PATCH 5/8] mach-defpager: fix warning about uninitialized variable,
Justus Winter <=
- [PATCH 2/8] mach-defpager: fix warnings about unused variables, Justus Winter, 2014/03/12
- [PATCH 8/8] mach-defpager: silently ignore requests to page to active partition, Justus Winter, 2014/03/12
- [PATCH 6/8] mach-defpager: fix warnings about uninitialized variables, Justus Winter, 2014/03/12
- [PATCH 7/8] mach-defpager: fix type of size arguments, Justus Winter, 2014/03/12
- Re: [PATCH 1/8] mach-defpager: remove comments around form feeds, Samuel Thibault, 2014/03/12