]> git.tue.mpg.de Git - paraslash.git/commitdiff
Avoid division by zero in setup_next_fec_group().
authorAndre Noll <maan@systemlinux.org>
Thu, 5 Mar 2009 21:03:14 +0000 (22:03 +0100)
committerAndre Noll <maan@systemlinux.org>
Thu, 5 Mar 2009 21:03:14 +0000 (22:03 +0100)
This needs more work.

vss.c

diff --git a/vss.c b/vss.c
index 4efe38f6560d3fafab67699d351aa1c0be7083d5..d0e1cf53242a52bbdcef4b486136747239784734 100644 (file)
--- 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;