From: Andre Noll Date: Thu, 5 Mar 2009 21:03:14 +0000 (+0100) Subject: Avoid division by zero in setup_next_fec_group(). X-Git-Tag: v0.3.4~52 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=132ab6b63568104d28af23a9682c770a0aaedf03;p=paraslash.git Avoid division by zero in setup_next_fec_group(). This needs more work. --- diff --git a/vss.c b/vss.c index 4efe38f6..d0e1cf53 100644 --- a/vss.c +++ b/vss.c @@ -238,6 +238,9 @@ static int setup_next_fec_group(struct fec_client *fc, struct vss_task *vsst) fc->group.num_chunks = i - fc->group.first_chunk; fc->slice.num = 0; fc->slice.bytes = ROUND_UP(fc->group.bytes, k) / k; + /* FIXME: Avoid division by zero in a better way */ + if (!fc->slice.bytes) + return 0; /* The last slice will not be fully used */ last_payload_size = fc->group.bytes % fc->slice.bytes;