aboutsummaryrefslogtreecommitdiff
path: root/lib/livepatch/test_klp_shadow_vars.c
AgeCommit message (Collapse)AuthorFilesLines
2019-02-06livepatch: Proper error handling in the shadow variables selftestPetr Mladek1-0/+22
Add proper error handling when allocating or getting shadow variables in the selftest. It prevents an invalid pointer access in some situations. It shows the good programming practice in the others. The error codes are just the best guess and specific for this particular test. In general, klp_shadow_alloc() returns NULL also when the given shadow variable has already been allocated. In addition, both klp_shadow_alloc() and klp_shadow_get_or_alloc() might fail from other reasons when the constructor fails. Note, that the error code is not really important even in the real life. The use of shadow variables should be transparent for the original livepatched code. Acked-by: Miroslav Benes <[email protected]> Acked-by: Joe Lawrence <[email protected]> Signed-off-by: Petr Mladek <[email protected]>
2019-02-06livepatch: return -ENOMEM on ptr_id() allocation failureJoe Lawrence1-1/+1
Fixes the following smatch warning: lib/livepatch/test_klp_shadow_vars.c:47 ptr_id() warn: returning -1 instead of -ENOMEM is sloppy Signed-off-by: Joe Lawrence <[email protected]> Acked-by: Miroslav Benes <[email protected]> Signed-off-by: Petr Mladek <[email protected]>
2019-01-11selftests/livepatch: introduce testsJoe Lawrence1-0/+236
Add a few livepatch modules and simple target modules that the included regression suite can run tests against: - basic livepatching (multiple patches, atomic replace) - pre/post (un)patch callbacks - shadow variable API Signed-off-by: Joe Lawrence <[email protected]> Signed-off-by: Petr Mladek <[email protected]> Tested-by: Miroslav Benes <[email protected]> Tested-by: Alice Ferrazzi <[email protected]> Acked-by: Joe Lawrence <[email protected]> Acked-by: Josh Poimboeuf <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>