Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching
Pull livepatch update from Jiri Kosina: "Return value checking fixup in livepatching samples, from Nicholas Mc Guire" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching: livepatch: check kzalloc return values
This commit is contained in:
commit
1686cc1a31
|
@ -89,6 +89,11 @@ struct dummy *livepatch_fix1_dummy_alloc(void)
|
|||
* pointer to handle resource release.
|
||||
*/
|
||||
leak = kzalloc(sizeof(int), GFP_KERNEL);
|
||||
if (!leak) {
|
||||
kfree(d);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
klp_shadow_alloc(d, SV_LEAK, sizeof(leak), GFP_KERNEL,
|
||||
shadow_leak_ctor, leak);
|
||||
|
||||
|
|
|
@ -118,6 +118,10 @@ noinline struct dummy *dummy_alloc(void)
|
|||
|
||||
/* Oops, forgot to save leak! */
|
||||
leak = kzalloc(sizeof(int), GFP_KERNEL);
|
||||
if (!leak) {
|
||||
kfree(d);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pr_info("%s: dummy @ %p, expires @ %lx\n",
|
||||
__func__, d, d->jiffies_expire);
|
||||
|
|
Loading…
Reference in New Issue