]> Git Repo - J-u-boot.git/blob - cmd/stackprot_test.c
Merge tag 'v2024.07-rc5' into next
[J-u-boot.git] / cmd / stackprot_test.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  *  Copyright 2021 Broadcom
4  */
5
6 #include <command.h>
7
8 static int do_test_stackprot_fail(struct cmd_tbl *cmdtp, int flag, int argc,
9                                   char *const argv[])
10 {
11         /*
12          * In order to avoid having the compiler optimize away the stack smashing
13          * we need to do a little something here.
14          */
15         char a[128];
16
17         memset(a, 0xa5, 512);
18
19         printf("We have smashed our stack as this should not exceed 128: sizeof(a) = %zd\n",
20                strlen(a));
21
22         return 0;
23 }
24
25 U_BOOT_CMD(stackprot_test, 1, 1, do_test_stackprot_fail,
26            "test stack protector fail", "");
This page took 0.026126 seconds and 4 git commands to generate.