livepatch: robustify klp_register_patch() API error checking
authorJiri Kosina <jkosina@suse.cz>
Thu, 7 Apr 2016 16:06:25 +0000 (18:06 +0200)
committerJiri Kosina <jkosina@suse.cz>
Thu, 7 Apr 2016 18:42:38 +0000 (20:42 +0200)
commit61bf12d3304d78ff499245ea995858c3bedb162e
treee0f558a6afea387144af7561e1cc6a978c82ea48
parent3b812ecce736432e6b55e77028ea387eb1517d24
livepatch: robustify klp_register_patch() API error checking

Commit 425595a7fc20 ("livepatch: reuse module loader code to write
relocations") adds a possibility of dereferncing pointers supplied by the
consumer of the livepatch API before sanity (NULL) checking them (patch
and patch->mod).

Spotted by smatch tool.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Acked-by: Jessica Yu <jeyu@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
kernel/livepatch/core.c