if: safeguard hash_index

This commit is contained in:
Thomas Schoebel-Theuer 2021-03-01 11:56:09 +01:00
parent 16d623c25b
commit d619051ff3
2 changed files with 4 additions and 4 deletions

View File

@ -331,7 +331,7 @@ void _if_unplug(struct if_input *input)
while (!list_empty(&tmp_list)) {
struct if_mref_aspect *mref_a;
struct mref_object *mref;
int hash_index;
unsigned int hash_index;
unsigned long flags;
mref_a = container_of(tmp_list.next, struct if_mref_aspect, plug_head);
@ -620,7 +620,7 @@ void if_make_request(struct request_queue *q, struct bio *bio)
while (bv_len > 0) {
struct list_head *tmp;
int hash_index;
unsigned int hash_index;
int this_len = 0;
unsigned long flags;
@ -629,7 +629,7 @@ void if_make_request(struct request_queue *q, struct bio *bio)
MARS_IO("rw = %d i = %d pos = %lld bv_page = %p bv_offset = %d data = %p bv_len = %d\n", rw, i, pos, bvec->bv_page, bvec->bv_offset, data, bv_len);
hash_index = (pos / IF_HASH_CHUNK) % IF_HASH_MAX;
hash_index = ((unsigned long)pos / IF_HASH_CHUNK) % IF_HASH_MAX;
#ifdef REQUEST_MERGING
traced_lock(&input->hash_table[hash_index].hash_lock, flags);

View File

@ -56,7 +56,7 @@ struct if_mref_aspect {
GENERIC_ASPECT(mref);
struct list_head plug_head;
struct list_head hash_head;
int hash_index;
unsigned int hash_index;
int bio_count;
int current_len;
int max_len;