aboutsummaryrefslogtreecommitdiff
path: root/samples/livepatch/livepatch-shadow-fix2.c
diff options
context:
space:
mode:
authorPetr Mladek <[email protected]>2020-01-16 16:31:42 +0100
committerJiri Kosina <[email protected]>2020-01-17 11:12:06 +0100
commit8f6b88662cacb1d01398c1e8be52aeac433189f6 (patch)
tree29ed4a7bbc4cbff644df8f5cf54400956ccb09c9 /samples/livepatch/livepatch-shadow-fix2.c
parentf838767555d40f29bc4771c5c8cc63193094b7cc (diff)
livepatch/sample: Use the right type for the leaking data pointer
The "leak" pointer, in the sample of shadow variable API, is allocated as sizeof(int). Let's help developers and static analyzers with understanding the code by using the appropriate pointer type. Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Petr Mladek <[email protected]> Reviewed-by: Joe Lawrence <[email protected]> Acked-by: Miroslav Benes <[email protected]> Reviewed-by: Kamalesh Babulal <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
Diffstat (limited to 'samples/livepatch/livepatch-shadow-fix2.c')
-rw-r--r--samples/livepatch/livepatch-shadow-fix2.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/samples/livepatch/livepatch-shadow-fix2.c b/samples/livepatch/livepatch-shadow-fix2.c
index 50d223b82e8b..29fe5cd42047 100644
--- a/samples/livepatch/livepatch-shadow-fix2.c
+++ b/samples/livepatch/livepatch-shadow-fix2.c
@@ -59,7 +59,7 @@ static bool livepatch_fix2_dummy_check(struct dummy *d, unsigned long jiffies)
static void livepatch_fix2_dummy_leak_dtor(void *obj, void *shadow_data)
{
void *d = obj;
- void **shadow_leak = shadow_data;
+ int **shadow_leak = shadow_data;
kfree(*shadow_leak);
pr_info("%s: dummy @ %p, prevented leak @ %p\n",
@@ -68,7 +68,7 @@ static void livepatch_fix2_dummy_leak_dtor(void *obj, void *shadow_data)
static void livepatch_fix2_dummy_free(struct dummy *d)
{
- void **shadow_leak;
+ int **shadow_leak;
int *shadow_count;
/* Patch: copy the memory leak patch from the fix1 module. */