Linux ATA/IDE development
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: linux-ide@vger.kernel.org
Subject: potential null deref in ide_port_apply_params()
Date: Sun, 19 Jul 2009 14:44:45 +0300 (EAT)	[thread overview]
Message-ID: <alpine.DEB.2.00.0907171311110.12306@bicker> (raw)

Should the "||" in ide_port_for_each_dev() be changed to "&&"?  With the 
current code it looks like "drive" could be null ide_port_apply_params().

#define ide_port_for_each_dev(i, dev, port) \
        for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++)

Here is ide_port_apply_params() from drivers/ide/ide.c
   361          ide_port_for_each_dev(i, drive, hwif)
   362                  ide_dev_apply_params(drive, i);

There are a couple similar macros and the callers generally seem to assume 
that drive is non null.

regards,
dan carpenter


                 reply	other threads:[~2009-07-19 12:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=alpine.DEB.2.00.0907171311110.12306@bicker \
    --to=error27@gmail.com \
    --cc=linux-ide@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