diff options
author | Petr Mladek <pmladek@suse.com> | 2020-01-16 18:31:42 +0300 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2020-01-17 13:12:06 +0300 |
commit | 8f6b88662cacb1d01398c1e8be52aeac433189f6 (patch) | |
tree | 29ed4a7bbc4cbff644df8f5cf54400956ccb09c9 /samples/livepatch/livepatch-shadow-mod.c | |
parent | f838767555d40f29bc4771c5c8cc63193094b7cc (diff) | |
download | linux-8f6b88662cacb1d01398c1e8be52aeac433189f6.tar.xz |
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 <dan.carpenter@oracle.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Reviewed-by: Joe Lawrence <joe.lawrence@redhat.com>
Acked-by: Miroslav Benes <mbenes@suse.cz>
Reviewed-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'samples/livepatch/livepatch-shadow-mod.c')
-rw-r--r-- | samples/livepatch/livepatch-shadow-mod.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/samples/livepatch/livepatch-shadow-mod.c b/samples/livepatch/livepatch-shadow-mod.c index ecfe83a943a7..7e753b0d2fa6 100644 --- a/samples/livepatch/livepatch-shadow-mod.c +++ b/samples/livepatch/livepatch-shadow-mod.c @@ -95,7 +95,7 @@ struct dummy { static __used noinline struct dummy *dummy_alloc(void) { struct dummy *d; - void *leak; + int *leak; d = kzalloc(sizeof(*d), GFP_KERNEL); if (!d) @@ -105,7 +105,7 @@ static __used noinline struct dummy *dummy_alloc(void) msecs_to_jiffies(1000 * EXPIRE_PERIOD); /* Oops, forgot to save leak! */ - leak = kzalloc(sizeof(int), GFP_KERNEL); + leak = kzalloc(sizeof(*leak), GFP_KERNEL); if (!leak) { kfree(d); return NULL; |