mirror of https://github.com/schoebel/mars
mapfree: safeguard calling conventions
This commit is contained in:
parent
a8039c4a70
commit
3bd3d9b269
|
@ -154,14 +154,21 @@ void _mapfree_put(struct mapfree_info *mf)
|
|||
|
||||
void mapfree_put(struct mapfree_info *mf)
|
||||
{
|
||||
if (likely(mf && mf->mf_hash < MAPFREE_HASH)) {
|
||||
unsigned int hash = mf->mf_hash;
|
||||
unsigned int hash;
|
||||
|
||||
if (unlikely(!mf))
|
||||
return;
|
||||
|
||||
hash = mf->mf_hash;
|
||||
if (unlikely(hash >= MAPFREE_HASH)) {
|
||||
MARS_ERR("Bad mapfree hash %d\n", hash);
|
||||
return;
|
||||
}
|
||||
|
||||
down_write(&mf_table[hash].hash_mutex);
|
||||
_mapfree_put(mf);
|
||||
up_write(&mf_table[hash].hash_mutex);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mapfree_put);
|
||||
|
||||
loff_t mapfree_real_size(struct mapfree_info *mf)
|
||||
|
@ -334,8 +341,19 @@ EXPORT_SYMBOL_GPL(mapfree_get);
|
|||
|
||||
void mapfree_set(struct mapfree_info *mf, loff_t min, loff_t max)
|
||||
{
|
||||
if (likely(mf && mf->mf_hash < MAPFREE_HASH)) {
|
||||
struct mf_hash_anchor *mha = &mf_table[mf->mf_hash];
|
||||
struct mf_hash_anchor *mha;
|
||||
unsigned int hash;
|
||||
|
||||
if (unlikely(!mf))
|
||||
return;
|
||||
|
||||
hash = mf->mf_hash;
|
||||
if (unlikely(hash >= MAPFREE_HASH)) {
|
||||
MARS_ERR("Bad mapfree hash %d\n", hash);
|
||||
return;
|
||||
}
|
||||
|
||||
mha = &mf_table[hash];
|
||||
|
||||
down_write(&mha->hash_mutex);
|
||||
if (!mf->mf_min[0] || mf->mf_min[0] > min)
|
||||
|
@ -344,7 +362,6 @@ void mapfree_set(struct mapfree_info *mf, loff_t min, loff_t max)
|
|||
mf->mf_max = max;
|
||||
up_write(&mha->hash_mutex);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mapfree_set);
|
||||
|
||||
static
|
||||
|
|
Loading…
Reference in New Issue