From: Nick Alcock Date: Mon, 23 May 2016 21:27:40 +0000 (+0100) Subject: dtrace: migrate pdata size assertion out of generic code X-Git-Tag: v4.1.12-111.0.20170907_2225~3^2~3^2~45 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=0866c61c7f5fb7bc098b1894a868b29da4d29c8e;p=users%2Fjedix%2Flinux-maple.git dtrace: migrate pdata size assertion out of generic code Only arch-specific code cares about this invariant, and it may not exist on other future arches, so duplicate it on all arches that care. Signed-off-by: Nick Alcock Acked-by: Kris Van Hees --- diff --git a/dtrace/dtrace_dev.c b/dtrace/dtrace_dev.c index 8d79da22d46b8..cce388c389e06 100644 --- a/dtrace/dtrace_dev.c +++ b/dtrace/dtrace_dev.c @@ -1385,12 +1385,6 @@ int dtrace_dev_init(void) int rc = 0; struct cred *cred; - /* - * Sanity check to ensure that the memory allocated by the kernel is - * sufficient for what PDATA needs. - */ - ASSERT(sizeof(dtrace_module_t) < DTRACE_PDATA_SIZE); - /* * Register the device for the DTrace core. */ diff --git a/dtrace/include/x86_64/dtrace/mod_arch.h b/dtrace/include/x86_64/dtrace/mod_arch.h index 5db59861d2b27..583baca0d65fb 100644 --- a/dtrace/include/x86_64/dtrace/mod_arch.h +++ b/dtrace/include/x86_64/dtrace/mod_arch.h @@ -25,6 +25,8 @@ * Use is subject to license terms. */ +#include + /* * Structure to hold DTrace specific information about modules (including the * core kernel module). Note that each module (and the main kernel) already diff --git a/dtrace/sdt_sparc64.c b/dtrace/sdt_sparc64.c index 8fe02a0b08b65..a1f77431d4b61 100644 --- a/dtrace/sdt_sparc64.c +++ b/dtrace/sdt_sparc64.c @@ -178,6 +178,12 @@ void sdt_disable_arch(sdt_probe_t *sdp, dtrace_id_t id, void *arg) int sdt_dev_init_arch(void) { + /* + * Sanity check to ensure that the memory allocated by the kernel is + * sufficient for what PDATA needs. + */ + ASSERT(sizeof(dtrace_module_t) < DTRACE_PDATA_SIZE); + return 0; } diff --git a/dtrace/sdt_x86_64.c b/dtrace/sdt_x86_64.c index 1faac5b601da6..ac0226c7079da 100644 --- a/dtrace/sdt_x86_64.c +++ b/dtrace/sdt_x86_64.c @@ -116,6 +116,12 @@ uint64_t sdt_getarg(void *arg, dtrace_id_t id, void *parg, int argno, int sdt_dev_init_arch(void) { + /* + * Sanity check to ensure that the memory allocated by the kernel is + * sufficient for what PDATA needs. + */ + ASSERT(sizeof(dtrace_module_t) < DTRACE_PDATA_SIZE); + return dtrace_invop_add(sdt_invop); }