Subject: [Bug 214867] UBSAN: shift-out-of-bounds in drivers/of/unittest.c:1933:36

From: [email-masked]
Date: Fri, 29 Oct 2021 14:06:48 +0000

https://bugzilla.kernel.org/show_bug.cgi?id=214867

Arnd Bergmann ([email-masked]) changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            [email-masked]

--- Comment #2 from Arnd Bergmann ([email-masked]) ---
This is the function that triggers it:

static void of_unittest_untrack_overlay(int id)
{
        if (overlay_first_id < 0)
                return;
        id -= overlay_first_id;
        if (WARN_ON(id >= MAX_UNITTEST_OVERLAYS))
                return;
        overlay_id_bits[BIT_WORD(id)] &= ~BIT_MASK(id);
}

My guess is that 'id' is negative here, which means it fails to tigger the
WARN_ON() but ends up still being out of range.

Can you try changing it to 'unsigned int id'?

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.