Correct several documentation issues: - Change "Add below unit test code" to "Add the following unit test code" - Change grammar in error descriptions to use proper subject-verb agreement - Correct RST directive syntax from "Note::" to ".. Note::"
Signed-off-by: Stephen Hemminger <[email protected]> --- doc/guides/prog_guide/asan.rst | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/doc/guides/prog_guide/asan.rst b/doc/guides/prog_guide/asan.rst index 9a6c5a7e4b..b770ac9029 100644 --- a/doc/guides/prog_guide/asan.rst +++ b/doc/guides/prog_guide/asan.rst @@ -39,7 +39,7 @@ to define ASAN_SHADOW_OFFSET. Example heap-buffer-overflow error ---------------------------------- -Add below unit test code in examples/helloworld/main.c:: +Add the following unit test code to examples/helloworld/main.c:: Add code to helloworld: char *p = rte_zmalloc(NULL, 9, 0); @@ -49,7 +49,9 @@ Add below unit test code in examples/helloworld/main.c:: } p[9] = 'a'; -Above code will result in heap-buffer-overflow error if ASan is enabled, because apply 9 bytes of memory but access the tenth byte, detailed error log as below:: +This code will result in a heap-buffer-overflow error if ASan is enabled, +because it allocates 9 bytes of memory but accesses the tenth byte. +Detailed error log:: ==369953==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7fb17f465809 at pc 0x5652e6707b84 bp 0x7ffea70eea20 sp 0x7ffea70eea10 WRITE of size 1 at 0x7fb17f465809 thread T0 #0 0x5652e6707b83 in main ../examples/helloworld/main.c:47 @@ -59,7 +61,7 @@ Above code will result in heap-buffer-overflow error if ASan is enabled, because Address 0x7fb17f465809 is a wild pointer. SUMMARY: AddressSanitizer: heap-buffer-overflow ../examples/helloworld/main.c:47 in main -Note:: +.. Note:: - Some of the features of ASan (for example, 'Display memory application location, currently displayed as a wild pointer') are not currently supported with DPDK allocations. @@ -67,7 +69,7 @@ Note:: Example use-after-free error ---------------------------- -Add below unit test code in examples/helloworld/main.c:: +Add the following unit test code to examples/helloworld/main.c:: Add code to helloworld: char *p = rte_zmalloc(NULL, 9, 0); @@ -78,7 +80,9 @@ Add below unit test code in examples/helloworld/main.c:: rte_free(p); *p = 'a'; -Above code will result in use-after-free error if ASan is enabled, because apply 9 bytes of memory but access the first byte after release, detailed error log as below:: +This code will result in a use-after-free error if ASan is enabled, +because it accesses the first byte of memory after it has been freed. +Detailed error log:: ==417048==ERROR: AddressSanitizer: heap-use-after-free on address 0x7fc83f465800 at pc 0x564308a39b89 bp 0x7ffc8c85bf50 sp 0x7ffc8c85bf40 WRITE of size 1 at 0x7fc83f465800 thread T0 #0 0x564308a39b88 in main ../examples/helloworld/main.c:48 -- 2.51.0

