[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CALCETrU9QFBhJeES61FiKbNsF=ZUnmF9H3cg-6Gup-ov3PrpyA@mail.gmail.com>
Date: Tue, 10 Jun 2014 09:13:49 -0700
From: Andy Lutomirski <luto@...capital.net>
To: Richard Weinberger <richard@....at>
Cc: "the arch/x86 maintainers" <x86@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: Out-of-bounds access in vread_hpet()
On Mon, Jun 9, 2014 at 11:36 PM, Richard Weinberger <richard@....at> wrote:
> FYI:
> ________________________________________________________________________________________________________
> *** CID 1222081: Out-of-bounds access (ARRAY_VS_SINGLETON)
> /arch/x86/vdso/vclock_gettime.c: 38 in vread_hpet()
> 32 #ifdef CONFIG_HPET_TIMER
> 33 extern u8 hpet_page
> 34 __attribute__((visibility("hidden")));
> 35
> 36 static notrace cycle_t vread_hpet(void)
> 37 {
>>>> CID 1222081: Out-of-bounds access (ARRAY_VS_SINGLETON)
>>>> Using "&hpet_page" as an array. This might corrupt or misinterpret adjacent memory locations.
> 38 return *(const volatile u32 *)(&hpet_page + HPET_COUNTER);
That's a false positive. HPET_COUNTER is a compile-time constant
index of a register, and hpet_page is the base address where the thing
is mapped.
I can change the code if there's something non-ugly that makes it
clearer, but ISTM that this particular warning might not make so much
sense when the offset is a real constant like this.
Hmm. Maybe hpet_page could be redefined as const char hpet_page[PAGE_SIZE].
--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists