public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: dan.carpenter@oracle.com
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch] ide: silence some underflow warnings
Date: Mon, 18 Jan 2016 19:12:53 +0000	[thread overview]
Message-ID: <20160118.141253.803019327755668580.davem@davemloft.net> (raw)
In-Reply-To: <20151113143401.GC1445@mwanda>

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Fri, 13 Nov 2015 17:34:01 +0300

> Back in the day we used to just say this code was root only so it was
> ok that the bounds checking was sloppy.  These days it annoys static
> checkers so we fix it.
> 
> In the original code "c > INT_MAX" was never true since "c" was an int.
> I am not sure what was intended so I left it alone.  But because I made
> "c" unsigned it means we don't have a warning any more.
> 
> The second warning is that we cap "i" but allow negatives leading to an
> underflow of the ide_disks_chs[] array.  The third set of warnings is
> because these values come from the user and we cap most of the upper
> bounds but allow negative values.  Negative cylinders doesn't make
> sense.
> 
> drivers/ide/ide.c:262 ide_set_disk_chs() warn: impossible condition '(c > ((~0 >> 1))) => (s32min-s32max > s32max)'
> drivers/ide/ide.c:270 ide_set_disk_chs() warn: check 'ide_disks_chs[i]' for negative offsets 'i' = s32min.  extra = 's32min-19'
> drivers/ide/ide.c:271 ide_set_disk_chs() warn: no lower bound on 'h'
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied.

      reply	other threads:[~2016-01-18 19:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-13 14:34 [patch] ide: silence some underflow warnings Dan Carpenter
2016-01-18 19:12 ` David Miller [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=20160118.141253.803019327755668580.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-ide@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox