xlators/dht : divide by zero coverity fix

CID:1226163. BUG: 789278

Change-Id: Ie31d65da236d7029784defad963672b2ded2676a
BUG:1192435
Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com>
Signed-off-by: Humble Devassy Chirammal <hchiramm@redhat.com>
Reviewed-on: http://review.gluster.org/9563
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: N Balachandran <nbalacha@redhat.com>
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
This commit is contained in:
Manikandan Selvaganesh 2015-02-03 15:21:51 +05:30 committed by Shyamsundar Ranganathan
parent e944ff1f5a
commit 8e1fb1ca03

View File

@ -1572,7 +1572,7 @@ dht_selfheal_layout_new_directory (call_frame_t *frame, loc_t *loc,
}
}
if (weight_by_size) {
if (weight_by_size && total_size) {
/* We know total_size is not zero. */
chunk = ((unsigned long) 0xffffffff) / total_size;
gf_log (this->name, GF_LOG_INFO,
@ -1580,6 +1580,7 @@ dht_selfheal_layout_new_directory (call_frame_t *frame, loc_t *loc,
total_size, chunk);
}
else {
weight_by_size = _gf_false;
chunk = ((unsigned long) 0xffffffff) / bricks_to_use;
}