* [PATCH v2] lkdtm/bugs: fix build error in lkdtm_EXHAUST_STACK
@ 2019-08-27 17:36 Raul E Rangel
2019-08-28 20:29 ` Kees Cook
0 siblings, 1 reply; 2+ messages in thread
From: Raul E Rangel @ 2019-08-27 17:36 UTC (permalink / raw)
To: keescook; +Cc: Raul E Rangel, Greg Kroah-Hartman, Arnd Bergmann, linux-kernel
lkdtm/bugs.c:94:2: error: format '%d' expects argument of type 'int', but argument 2 has type 'long unsigned int' [-Werror=format=]
pr_info("Calling function with %d frame size to depth %d ...\n",
^
THREAD_SIZE is defined as a unsigned long, cast CONFIG_FRAME_WARN to
unsigned long as well.
Fixes: 24cccab42c419 ("lkdtm/bugs: Adjust recursion test to avoid elision")
Signed-off-by: Raul E Rangel <rrangel@chromium.org>
---
Changes in v2:
- Correctly cast CONFIG_FRAME_WARN so the type is consistent.
drivers/misc/lkdtm/bugs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/lkdtm/bugs.c b/drivers/misc/lkdtm/bugs.c
index 1606658b9b7e..24245ccdba72 100644
--- a/drivers/misc/lkdtm/bugs.c
+++ b/drivers/misc/lkdtm/bugs.c
@@ -22,7 +22,7 @@ struct lkdtm_list {
* recurse past the end of THREAD_SIZE by default.
*/
#if defined(CONFIG_FRAME_WARN) && (CONFIG_FRAME_WARN > 0)
-#define REC_STACK_SIZE (CONFIG_FRAME_WARN / 2)
+#define REC_STACK_SIZE (_AC(CONFIG_FRAME_WARN, UL) / 2)
#else
#define REC_STACK_SIZE (THREAD_SIZE / 8)
#endif
@@ -91,7 +91,7 @@ void lkdtm_LOOP(void)
void lkdtm_EXHAUST_STACK(void)
{
- pr_info("Calling function with %d frame size to depth %d ...\n",
+ pr_info("Calling function with %lu frame size to depth %d ...\n",
REC_STACK_SIZE, recur_count);
recursive_loop(recur_count);
pr_info("FAIL: survived without exhausting stack?!\n");
--
2.23.0.187.g17f5b7556c-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] lkdtm/bugs: fix build error in lkdtm_EXHAUST_STACK
2019-08-27 17:36 [PATCH v2] lkdtm/bugs: fix build error in lkdtm_EXHAUST_STACK Raul E Rangel
@ 2019-08-28 20:29 ` Kees Cook
0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2019-08-28 20:29 UTC (permalink / raw)
To: Raul E Rangel; +Cc: Greg Kroah-Hartman, Arnd Bergmann, linux-kernel
On Tue, Aug 27, 2019 at 11:36:19AM -0600, Raul E Rangel wrote:
> lkdtm/bugs.c:94:2: error: format '%d' expects argument of type 'int', but argument 2 has type 'long unsigned int' [-Werror=format=]
> pr_info("Calling function with %d frame size to depth %d ...\n",
> ^
> THREAD_SIZE is defined as a unsigned long, cast CONFIG_FRAME_WARN to
> unsigned long as well.
>
> Fixes: 24cccab42c419 ("lkdtm/bugs: Adjust recursion test to avoid elision")
> Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Thanks for the update! (Greg, can you take this instead?)
Acked-by: Kees Cook <keescook@chromium.org>
-Kees
> ---
>
> Changes in v2:
> - Correctly cast CONFIG_FRAME_WARN so the type is consistent.
>
> drivers/misc/lkdtm/bugs.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/misc/lkdtm/bugs.c b/drivers/misc/lkdtm/bugs.c
> index 1606658b9b7e..24245ccdba72 100644
> --- a/drivers/misc/lkdtm/bugs.c
> +++ b/drivers/misc/lkdtm/bugs.c
> @@ -22,7 +22,7 @@ struct lkdtm_list {
> * recurse past the end of THREAD_SIZE by default.
> */
> #if defined(CONFIG_FRAME_WARN) && (CONFIG_FRAME_WARN > 0)
> -#define REC_STACK_SIZE (CONFIG_FRAME_WARN / 2)
> +#define REC_STACK_SIZE (_AC(CONFIG_FRAME_WARN, UL) / 2)
> #else
> #define REC_STACK_SIZE (THREAD_SIZE / 8)
> #endif
> @@ -91,7 +91,7 @@ void lkdtm_LOOP(void)
>
> void lkdtm_EXHAUST_STACK(void)
> {
> - pr_info("Calling function with %d frame size to depth %d ...\n",
> + pr_info("Calling function with %lu frame size to depth %d ...\n",
> REC_STACK_SIZE, recur_count);
> recursive_loop(recur_count);
> pr_info("FAIL: survived without exhausting stack?!\n");
> --
> 2.23.0.187.g17f5b7556c-goog
>
--
Kees Cook
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-08-28 20:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-27 17:36 [PATCH v2] lkdtm/bugs: fix build error in lkdtm_EXHAUST_STACK Raul E Rangel
2019-08-28 20:29 ` Kees Cook
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.