All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] net: emaclite: Use resource_size
Date: Thu, 06 May 2010 10:45:36 +0000	[thread overview]
Message-ID: <20100506104536.GL27064@bicker> (raw)
In-Reply-To: <1273133540-6894-1-git-send-email-tklauser@distanz.ch>

On Thu, May 06, 2010 at 12:07:05PM +0200, Dan Carpenter wrote:
> Since you're doing this, here are some smatch warnings with potential
> off-by-one bugs:
> 

Btw.  The heuristic that smatch uses here is if the parameter is (x - y)
and neither x nor y is a sizeof() then complain.  Don't complain about
more complicated expressions like x - y - z.

If it's a simple assignment expression like:
foo = x - y;
ioremap_nocache(x, foo);
The smatch check tries to catch those as well.

Smatch checks the parameters to: ioremap_nocache(), ioremap(),
__request_region(), __release_region(), __devm_request_region(), and
__devm_release_region().

The test has a couple false positives:
drivers/net/netxen/netxen_nic_main.c +633 netxen_setup_pci_map(27) warn:
	consider using resource_size() here

Most people use x - y where both x and y are valid registers but netxen
does x - y where x is one past the end.  It does this consistently.

drivers/parport/parport_pc.c +2530 parport_pc_unregister_port(17) warn:
	consider using resource_size() here

The paraport driver frees part of the resources here and the rest a
couple lines down depending on if it's in PARPORT_MODE_ECP.

regards,
dan carpenter


  parent reply	other threads:[~2010-05-06 10:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-06  8:12 [PATCH] net: emaclite: Use resource_size Tobias Klauser
2010-05-06  8:12 ` Tobias Klauser
2010-05-06  8:23 ` David Miller
2010-05-06  8:23   ` David Miller
2010-05-06 10:07 ` Dan Carpenter
2010-05-06 10:45 ` Dan Carpenter [this message]
2010-05-06 12:06 ` Tobias Klauser

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=20100506104536.GL27064@bicker \
    --to=error27@gmail.com \
    --cc=kernel-janitors@vger.kernel.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.