mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
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>
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user