All of lore.kernel.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Stelian Pop <stelian@popies.net>
Cc: v4l-dvb-maintainer@linuxtv.org,
	Linus Torvalds <torvalds@osdl.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	Andrew Morton <akpm@osdl.org>
Subject: Re: [PATCH] Fix __ucmpdi2 in v4l2_norm_to_name()
Date: Fri, 5 Jan 2007 15:20:16 +0100	[thread overview]
Message-ID: <6bae980b60fd869e7067f3df2f5e2f6a@kernel.crashing.org> (raw)
In-Reply-To: <1167952757.20260.6.camel@voyager.dsnet>

>>> 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


      reply	other threads:[~2007-01-05 14:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-04 11:10 [PATCH] Fix __ucmpdi2 in v4l2_norm_to_name() Stelian Pop
2007-01-04 12:09 ` [v4l-dvb-maintainer] " Trent Piepho
2007-01-04 12:53   ` Stelian Pop
2007-01-04 22:48 ` Andrew Morton
2007-01-04 22:59   ` Mauro Carvalho Chehab
2007-01-04 23:18     ` Andrew Morton
2007-01-07 11:44       ` Mauro Carvalho Chehab
2007-01-15  9:22         ` Stelian Pop
2007-01-04 23:19     ` Stelian Pop
2007-01-05 14:20       ` Segher Boessenkool [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6bae980b60fd869e7067f3df2f5e2f6a@kernel.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=stelian@popies.net \
    --cc=torvalds@osdl.org \
    --cc=v4l-dvb-maintainer@linuxtv.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.