Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a5a4d5a4 authored by Lijuan Gao's avatar Lijuan Gao Committed by lijuang
Browse files

lkdtm: Correct the size value for WRITE_KERN



Correct the value of size, WRITE_KERN will not work as expected
if the do_overwritten is less than do_nothing.

Change-Id: I2c69c62829cd55f280efd63763316b91691c0620
Signed-off-by: default avatarLijuan Gao <lijuang@codeaurora.org>
parent 0778c6d8
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -109,7 +109,12 @@ void lkdtm_WRITE_KERN(void)
	size_t size;
	unsigned char *ptr;

	size = (unsigned long)do_overwritten - (unsigned long)do_nothing;
	if ((unsigned long)do_overwritten < (unsigned long)do_nothing)
		size = (unsigned long)do_nothing -
				(unsigned long)do_overwritten;
	else
		size = (unsigned long)do_overwritten -
				(unsigned long)do_nothing;
	ptr = (unsigned char *)do_overwritten;

	pr_info("attempting bad %zu byte write at %px\n", size, ptr);