All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Julia Lawall <julia@diku.dk>
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: bug list: assigning negative values to unsigned variables
Date: Wed, 27 Jan 2010 11:13:25 +0000	[thread overview]
Message-ID: <20100127111325.GC24796@bicker> (raw)
In-Reply-To: <Pine.LNX.4.64.1001271155430.20256@ask.diku.dk>

On Wed, Jan 27, 2010 at 11:57:06AM +0100, Julia Lawall wrote:
> On Wed, 27 Jan 2010, Dan Carpenter wrote:
> 
> > Fixing the places which assign negative values to unsigned variables is a good janitor task.
> 
> I had the impression that assignment to -1 was done sometimes as a 
> portable way to initialize the variable to 0xffff (for any number of f's).  
> So perhaps it is not so trivial to fix.
> 
> julia
> 

The grep removed those.

> > This list is from smatch:  grep -w "fit into 0" warns.txt | grep -v "\-1" | tee err-list

Also it removed some other real bugs as well, which I have listed below.  It 
should have been:  grep -w "fit into 0" warns.txt | grep -vw "\-1" | tee err-list

But you are right assigning -1 is idiomatic.  I'll push a change tomorrow so 
the grep isn't needed.

regards,
dan carpenter

drivers/net/bnx2x_link.c +864 bnx2x_cl45_write(38) warn: value -14 can't fit into 0 'rc'
drivers/net/bnx2x_link.c +884 bnx2x_cl45_write(58) warn: value -14 can't fit into 0 'rc'
drivers/net/bnx2x_link.c +934 bnx2x_cl45_read(40) warn: value -14 can't fit into 0 'rc'
drivers/net/bnx2x_link.c +957 bnx2x_cl45_read(63) warn: value -14 can't fit into 0 'rc'
drivers/pci/hotplug/ibmphp_hpc.c +391 pci_ctrl_write(2) warn: value -19 can't fit into 0 'rc'
drivers/usb/serial/iuu_phoenix.c +573 iuu_clk(133) warn: value -124 can't fit into 0 '*(priv->buf+Count++)'
net/llc/llc_station.c +691 llc_station_init(2) warn: value -105 can't fit into 0 'rc'
net/wireless/wext-compat.c +175 cfg80211_wext_giwrange(34) warn: value -110 can't fit into 0 'range->max_qual.level'

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: Julia Lawall <julia@diku.dk>
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: bug list: assigning negative values to unsigned variables
Date: Wed, 27 Jan 2010 14:13:25 +0300	[thread overview]
Message-ID: <20100127111325.GC24796@bicker> (raw)
In-Reply-To: <Pine.LNX.4.64.1001271155430.20256@ask.diku.dk>

On Wed, Jan 27, 2010 at 11:57:06AM +0100, Julia Lawall wrote:
> On Wed, 27 Jan 2010, Dan Carpenter wrote:
> 
> > Fixing the places which assign negative values to unsigned variables is a good janitor task.
> 
> I had the impression that assignment to -1 was done sometimes as a 
> portable way to initialize the variable to 0xffff (for any number of f's).  
> So perhaps it is not so trivial to fix.
> 
> julia
> 

The grep removed those.

> > This list is from smatch:  grep -w "fit into 0" warns.txt | grep -v "\-1" | tee err-list

Also it removed some other real bugs as well, which I have listed below.  It 
should have been:  grep -w "fit into 0" warns.txt | grep -vw "\-1" | tee err-list

But you are right assigning -1 is idiomatic.  I'll push a change tomorrow so 
the grep isn't needed.

regards,
dan carpenter

drivers/net/bnx2x_link.c +864 bnx2x_cl45_write(38) warn: value -14 can't fit into 0 'rc'
drivers/net/bnx2x_link.c +884 bnx2x_cl45_write(58) warn: value -14 can't fit into 0 'rc'
drivers/net/bnx2x_link.c +934 bnx2x_cl45_read(40) warn: value -14 can't fit into 0 'rc'
drivers/net/bnx2x_link.c +957 bnx2x_cl45_read(63) warn: value -14 can't fit into 0 'rc'
drivers/pci/hotplug/ibmphp_hpc.c +391 pci_ctrl_write(2) warn: value -19 can't fit into 0 'rc'
drivers/usb/serial/iuu_phoenix.c +573 iuu_clk(133) warn: value -124 can't fit into 0 '*(priv->buf+Count++)'
net/llc/llc_station.c +691 llc_station_init(2) warn: value -105 can't fit into 0 'rc'
net/wireless/wext-compat.c +175 cfg80211_wext_giwrange(34) warn: value -110 can't fit into 0 'range->max_qual.level'

  parent reply	other threads:[~2010-01-27 11:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-27 10:40 bug list: assigning negative values to unsigned variables Dan Carpenter
2010-01-27 10:40 ` Dan Carpenter
2010-01-27 10:57 ` Julia Lawall
2010-01-27 10:57   ` Julia Lawall
2010-01-27 11:09   ` Bernd Petrovitsch
2010-01-27 11:09     ` Bernd Petrovitsch
2010-01-27 12:30     ` Julia Lawall
2010-01-27 12:30       ` Julia Lawall
2010-01-27 14:12       ` Bernd Petrovitsch
2010-01-27 14:12         ` Bernd Petrovitsch
2010-01-27 14:44         ` Al Viro
2010-01-27 11:13   ` Dan Carpenter [this message]
2010-01-27 11:13     ` Dan Carpenter

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=20100127111325.GC24796@bicker \
    --to=error27@gmail.com \
    --cc=julia@diku.dk \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@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.