From: Gerhard Sittig Date: Thu, 8 Feb 2018 22:16:40 +0000 (+0100) Subject: dreamsourcelab-dslogic: avoid division by zero X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=051e4beb79a9afabf5a3e9ca459d45559f0ee217;p=libsigrok.git dreamsourcelab-dslogic: avoid division by zero Do not align to block_size when its value is zero. This was reported by clang's scan-build. --- diff --git a/src/hardware/dreamsourcelab-dslogic/protocol.c b/src/hardware/dreamsourcelab-dslogic/protocol.c index 90b773d9..863b4e3b 100644 --- a/src/hardware/dreamsourcelab-dslogic/protocol.c +++ b/src/hardware/dreamsourcelab-dslogic/protocol.c @@ -914,6 +914,8 @@ static size_t get_buffer_size(const struct sr_dev_inst *sdi) */ const size_t block_size = enabled_channel_count(sdi) * 512; const size_t s = 10 * to_bytes_per_ms(sdi); + if (!block_size) + return s; return ((s + block_size - 1) / block_size) * block_size; }