From: Mathieu Desnoyers Date: Wed, 22 Feb 2012 00:20:51 +0000 (-0500) Subject: Fix: Return -EINVAL instead of print warning if non power of 2 size/num_subbuf X-Git-Tag: v2.0.0-rc2~43 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=e52b0723a0f08966ee0913707b549235b2bce96d;p=lttng-ust.git Fix: Return -EINVAL instead of print warning if non power of 2 size/num_subbuf Reported-by: Tan Dung Le Tran Signed-off-by: Mathieu Desnoyers --- diff --git a/libringbuffer/ring_buffer_backend.c b/libringbuffer/ring_buffer_backend.c index 9b334081..769e24bf 100644 --- a/libringbuffer/ring_buffer_backend.c +++ b/libringbuffer/ring_buffer_backend.c @@ -220,8 +220,10 @@ int channel_backend_init(struct channel_backend *chanb, /* * Make sure the number of subbuffers and subbuffer size are power of 2. */ - CHAN_WARN_ON(chanb, hweight32(subbuf_size) != 1); - CHAN_WARN_ON(chanb, hweight32(num_subbuf) != 1); + if (hweight32(subbuf_size) != 1) + return -EINVAL; + if (hweight32(num_subbuf) != 1) + return -EINVAL; ret = subbuffer_id_check_index(config, num_subbuf); if (ret)