From: Francis Deslauriers Date: Tue, 16 Oct 2018 19:23:22 +0000 (-0400) Subject: Fix: implicit declarations caused by buffer size checks. X-Git-Tag: v2.12.0-pre~111 X-Git-Url: http://git.liburcu.org/?a=commitdiff_plain;h=7502f47afaf537bbb67050b17ea095bb3976bf91;hp=7502f47afaf537bbb67050b17ea095bb3976bf91;p=lttng-modules.git Fix: implicit declarations caused by buffer size checks. Issue ===== Three kernel functions used in the following commit are unavailable on some supported kernels: commit 1f0ab1eb0409d23de5f67cc588c3ea4cee4d10e0 Prevent allocation of buffers if exceeding available memory * si_mem_available() was added in kernel 4.6 with commit d02bd27. * {set, clear}_current_oom_origin() were added in kernel 3.8 with commit: e1e12d2f Solution ======== Add wrappers around these functions such that older kernels will build with these functions defined as NOP or trivial return value. wrapper_check_enough_free_pages() uses the si_mem_available() kernel function to compute if the number pages requested passed as parameter is smaller than the number of pages available on the machine. If the si_mem_available() kernel function is unavailable, we always return true. wrapper_set_current_oom_origin() function wraps the set_current_oom_origin() kernel function when it is available. If set_current_oom_origin() is unavailable the wrapper is empty. wrapper_clear_current_oom_origin() function wraps the clear_current_oom_origin() kernel function when it is available. If clear_current_oom_origin() is unavailable the wrapper is empty. Drawbacks ========= None. Signed-off-by: Francis Deslauriers Signed-off-by: Mathieu Desnoyers ---