projects/linux·blob 5b6dca02 · refs

23 lines · 595 B

1// SPDX-License-Identifier: GPL-2.0
2/* Data introduced by the patch. */
3
4static const char __modinfo[]
5 __attribute__((section(".modinfo"), used, aligned(1))) = "\0name=vmlinux";
6
7#ifdef PATCHED
8/*
9 * Not an arithmetic progression: { 1, 2, 3, 4 } indexed by x & 3 is something
10 * a compiler can compute instead of load, and then target() has no reference
11 * to the array and there is nothing for klp diff to carry.
12 */
13static const int klp_new_data[4] __attribute__((used)) = { 7, 3, 11, 5 };
14#endif
15
16int target(int x)
17{
18#ifdef PATCHED
19 return x + klp_new_data[x & 3];
20#else
21 return x;
22#endif
23}