Re: [PATCH] lib/vdso: guard clockid before building u32 bitmask

From: sun jian

Date: Wed Jan 14 2026 - 04:32:01 EST


On Wed, Jan 14, 2026 at 4:56 PM Thomas Weißschuh
<thomas.weissschuh@xxxxxxxxxxxxx> wrote:
> So this looks like a false-positive. Can you post the sparse warning?
Here is the sparse warning I saw:

arch/x86/entry/vdso/vdso32/../../../../../lib/vdso/gettimeofday.c:454:26:
warning: shift too big (40) for type unsigned long

It is emitted when checking the vdso32 include path via vclock_gettime.c.

Given that vdso_clockid_valid() bounds clock to <= CLOCK_AUX_LAST (23),
the shift cannot reach that value in practice. So I agree this is a sparse
false positive in this analysis context.

I'll drop this patch rather than adding a redundant runtime check.

Thanks,
Sun