diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 442db23c0b..094b0558f7 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1804,7 +1804,7 @@ static int matroska_parse_laces(MatroskaDemuxContext *matroska, uint8_t **buf,
     }
 
     case 0x2: /* fixed-size lacing */
-        if (size != (size / *laces) * size) {
+        if (size % (*laces)) {
             res = AVERROR_INVALIDDATA;
             break;
         }