order = get_count_order_u64(chan.attr.subbuf_size);
assert(order >= 0);
rounded_size = 1ULL << order;
+ if (rounded_size < chan.attr.subbuf_size) {
+ ERR("The subbuf size (%" PRIu64 ") is rounded and overflows!",
+ chan.attr.subbuf_size);
+ ret = CMD_ERROR;
+ goto end;
+ }
+
if (rounded_size != chan.attr.subbuf_size) {
WARN("The subbuf size (%" PRIu64 ") is rounded to the next power of 2 (%" PRIu64 ")",
chan.attr.subbuf_size, rounded_size);
order = get_count_order_u64(chan.attr.num_subbuf);
assert(order >= 0);
rounded_size = 1ULL << order;
+ if (rounded_size < chan.attr.subbuf_size) {
+ ERR("The number of subbuffers (%" PRIu64 ") is rounded and overflows!",
+ chan.attr.num_subbuf);
+ ret = CMD_ERROR;
+ goto end;
+ }
+
if (rounded_size != chan.attr.num_subbuf) {
WARN("The number of subbuffers (%" PRIu64 ") is rounded to the next power of 2 (%" PRIu64 ")",
chan.attr.num_subbuf, rounded_size);