Messages in this thread | | | From | Geert Uytterhoeven <> | Date | Mon, 12 Feb 2024 13:46:01 +0100 | Subject | Re: [PATCH v6 0/2] lib: checksum: Fix issues with checksum tests |
| |
Hi Günter,
On Sun, Feb 11, 2024 at 8:18 PM Guenter Roeck <linux@roeck-us.net> wrote: > On 2/7/24 16:22, Charlie Jenkins wrote: > > The ip_fast_csum and csum_ipv6_magic tests did not have the data > > types properly casted, and improperly misaligned data. > > > > Signed-off-by: Charlie Jenkins <charlie@rivosinc.com> > > I sorted out most of the problems with this version, but I still get: > > # test_csum_ipv6_magic: ASSERTION FAILED at lib/checksum_kunit.c:513 > Expected ( u64)csum_result == ( u64)expected, but > ( u64)csum_result == 16630 (0x40f6) > ( u64)expected == 65535 (0xffff) > not ok 5 test_csum_ipv6_magic > > on m68k:q800. This is suspicious because there is no 0xffff in > expected_csum_ipv6_magic[]. With some debugging information: > > ####### num_tests=86 i=84 expect array size=84 > ####### MAX_LEN=512 WORD_ALIGNMENT=4 magic data size=42 > > That means the loop > > for (int i = 0; i < num_tests; i++) { > ... > expected = (__force __sum16)expected_csum_ipv6_magic[i]; > ... > } > > will access data beyond the end of the expected_csum_ipv6_magic[] array, > possibly because m68k doesn't pad struct csum_ipv6_magic_data to 44 bytes.
Exactly, sizeof(struct csum_ipv6_magic_data) = 42 on m68k. Hence struct csum_ipv6_magic_data needs an extra field "unsigned char pad[3];" at the end.
Gr{oetje,eeting}s,
Geert
-- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68korg
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
| |