linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bob Picco <bob.picco@hp.com>
To: Clemens Ladisch <clemens@ladisch.de>
Cc: linux-kernel@vger.kernel.org, akpm@osdl.org,
	Bob Picco <robert.picco@hp.com>
Subject: Re: [PATCH 1/2] HPET: disallow zero interrupt frequency
Date: Thu, 22 Sep 2005 15:14:19 -0400	[thread overview]
Message-ID: <20050922191419.GF16066@localhost.localdomain> (raw)
In-Reply-To: <20050922150832.21412.18884.balrog@ifiu24.informatik.uni-halle.de>

Clemens Ladisch wrote:	[Thu Sep 22 2005, 11:08:32AM EDT]
> Trying to set an interrupt frequency of zero would result in a
> division by zero, so disallow this.
> 
> Enabling the interrupt when the frequency hasn't yet been set would
> use an interrupt period of minimum length, so disallow this, too.
> 
> Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
> 
> --- linux-2.6.13.orig/drivers/char/hpet.c	2005-09-22 10:56:23.000000000 +0200
> +++ linux-2.6.13/drivers/char/hpet.c	2005-09-22 10:56:26.000000000 +0200
> @@ -365,6 +365,9 @@ static int hpet_ioctl_ieon(struct hpet_d
>  	hpet = devp->hd_hpet;
>  	hpetp = devp->hd_hpets;
>  
> +	if (!devp->hd_ireqfreq)
> +		return -EIO;
> +
>  	v = readq(&timer->hpet_config);
>  	spin_lock_irq(&hpet_lock);
>  
> @@ -517,7 +520,7 @@ hpet_ioctl_common(struct hpet_dev *devp,
>  			break;
>  		}
>  
> -		if (arg & (arg - 1)) {
> +		if (arg < 1 || (arg & (arg - 1))) {
Well it seems like what you want is:
		if (!arg || (arg & (arg - 1))) {
>  			err = -EINVAL;
>  			break;
>  		}
> -

BTW, it will be a day or two before I can review your other patch.

thanks,

bob

  parent reply	other threads:[~2005-09-22 19:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-22 15:08 [PATCH 1/2] HPET: disallow zero interrupt frequency Clemens Ladisch
2005-09-22 15:08 ` [PATCH 2/2] HPET: make frequency calculations 32 bit safe Clemens Ladisch
2005-09-27 14:57   ` Bob Picco
2005-09-30  6:30     ` Clemens Ladisch
2005-09-22 19:14 ` Bob Picco [this message]
2005-09-28  6:51   ` [PATCH 1/2] HPET: disallow zero interrupt frequency Clemens Ladisch

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=20050922191419.GF16066@localhost.localdomain \
    --to=bob.picco@hp.com \
    --cc=akpm@osdl.org \
    --cc=clemens@ladisch.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robert.picco@hp.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).