test_fortify.h (775B)
1/* SPDX-License-Identifier: GPL-2.0-only */ 2#include <linux/kernel.h> 3#include <linux/printk.h> 4#include <linux/slab.h> 5#include <linux/string.h> 6 7void do_fortify_tests(void); 8 9#define __BUF_SMALL 16 10#define __BUF_LARGE 32 11struct fortify_object { 12 int a; 13 char buf[__BUF_SMALL]; 14 int c; 15}; 16 17#define LITERAL_SMALL "AAAAAAAAAAAAAAA" 18#define LITERAL_LARGE "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" 19const char small_src[__BUF_SMALL] = LITERAL_SMALL; 20const char large_src[__BUF_LARGE] = LITERAL_LARGE; 21 22char small[__BUF_SMALL]; 23char large[__BUF_LARGE]; 24struct fortify_object instance; 25size_t size; 26 27void do_fortify_tests(void) 28{ 29 /* Normal initializations. */ 30 memset(&instance, 0x32, sizeof(instance)); 31 memset(small, 0xA5, sizeof(small)); 32 memset(large, 0x5A, sizeof(large)); 33 34 TEST; 35}