From: Mathieu Desnoyers Date: Thu, 25 Aug 2011 17:10:02 +0000 (-0400) Subject: Fix buffer allocation alignment error (fix overwrite mode) X-Git-Tag: v1.9.1~256 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=6c1f7d8b0c224a1cb2ef196c1bd3eb7115f53f51;p=lttng-ust.git Fix buffer allocation alignment error (fix overwrite mode) Signed-off-by: Mathieu Desnoyers --- diff --git a/libringbuffer/ring_buffer_backend.c b/libringbuffer/ring_buffer_backend.c index cac746c2..bec31a30 100644 --- a/libringbuffer/ring_buffer_backend.c +++ b/libringbuffer/ring_buffer_backend.c @@ -213,7 +213,7 @@ int channel_backend_init(struct channel_backend *chanb, struct channel *chan = caa_container_of(chanb, struct channel, backend); unsigned int i; int ret; - size_t shmsize = 0, bufshmsize = 0, num_subbuf_alloc; + size_t shmsize = 0, num_subbuf_alloc; if (!name) return -EPERM; @@ -257,11 +257,11 @@ int channel_backend_init(struct channel_backend *chanb, num_subbuf_alloc = num_subbuf + 1; shmsize += offset_align(shmsize, __alignof__(struct lib_ring_buffer_backend_pages_shmp)); shmsize += sizeof(struct lib_ring_buffer_backend_pages_shmp) * num_subbuf_alloc; - shmsize += offset_align(bufshmsize, PAGE_SIZE); + shmsize += offset_align(shmsize, PAGE_SIZE); shmsize += subbuf_size * num_subbuf_alloc; - shmsize += offset_align(bufshmsize, __alignof__(struct lib_ring_buffer_backend_pages)); + shmsize += offset_align(shmsize, __alignof__(struct lib_ring_buffer_backend_pages)); shmsize += sizeof(struct lib_ring_buffer_backend_pages) * num_subbuf_alloc; - shmsize += offset_align(bufshmsize, __alignof__(struct lib_ring_buffer_backend_subbuffer)); + shmsize += offset_align(shmsize, __alignof__(struct lib_ring_buffer_backend_subbuffer)); shmsize += sizeof(struct lib_ring_buffer_backend_subbuffer) * num_subbuf; /* Per-cpu buffer size: control (after backend) */ shmsize += offset_align(shmsize, __alignof__(struct commit_counters_hot));