All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@stusta.de>
To: Dan Williams <dan.j.williams@intel.com>
Cc: Jeff Garzik <jgarzik@pobox.com>,
	linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: drivers/scsi/sata_vsc.c: inconsistent NULL checking
Date: Thu, 9 Mar 2006 12:02:07 +0100	[thread overview]
Message-ID: <20060309110207.GA4006@stusta.de> (raw)

The Coverity checker found this inconsistent NULL checking recently 
introduced by the following commit:

  2ae5b30ff08cee422c7f6388a759f7
  Author: Dan Williams <dan.j.williams@intel.com>
  [PATCH] Necessary evil to get sata_vsc to initialize with Intel iq3124h hba


In function vsc_sata_interrupt():

	err_status = ap ? vsc_sata_scr_read(ap, SCR_ERROR) : 0;
	vsc_sata_scr_write(ap, SCR_ERROR, err_status);


vsc_sata_scr_write() always dereferences ap
(since SCR_ERROR < SCR_CONTROL).

Checking for NULL in one line and unconditionally dereferencing the 
variable in the next line can't be right.

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


             reply	other threads:[~2006-03-09 11:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-09 11:02 Adrian Bunk [this message]
2006-03-09 19:44 ` drivers/scsi/sata_vsc.c: inconsistent NULL checking Dan Williams
2006-03-09 20:41   ` Dan Williams
2006-03-22  3:08     ` Jeff Garzik

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=20060309110207.GA4006@stusta.de \
    --to=bunk@stusta.de \
    --cc=dan.j.williams@intel.com \
    --cc=jgarzik@pobox.com \
    --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 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.