[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <6bae980b60fd869e7067f3df2f5e2f6a@kernel.crashing.org>
Date: Fri, 5 Jan 2007 15:20:16 +0100
From: Segher Boessenkool <segher@...nel.crashing.org>
To: Stelian Pop <stelian@...ies.net>
Cc: v4l-dvb-maintainer@...uxtv.org, Linus Torvalds <torvalds@...l.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Mauro Carvalho Chehab <mchehab@...radead.org>,
Andrew Morton <akpm@...l.org>
Subject: Re: [PATCH] Fix __ucmpdi2 in v4l2_norm_to_name()
>>> The largest value we use here is 0x02000000. Perhaps v4l2_std_id
>>> shouldn't
>>> be 64-bit?
>> Too late to change it to 32 bits. It is at V4L2 userspace API since
>> kernel 2.6.0. We can, however use this approach as a workaround, with
>> the proper documentation.
>
> Maybe with a BUG_ON(id > UINT_MAX) ?
If the code code is like
u64 user_id;
u32 kernel_id = user_id;
(or different types, just showing the difference in word
lengths here) it's easiest and safest to do
BUG_ON(kernel_id != user_id);
i.e. cast back up to 64-bit, see if it's identical to the
original. You won't have to worry about sign extensions or
similar that way, the BUG_ON() condition expresses the actual
requirement directly.
Segher
-
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