From: Ewan Milne <emilne@redhat.com>
To: Tomas Winkler <tomas.winkler@intel.com>
Cc: James Bottomley <James.Bottomley@hansenpartnership.com>,
Christoph Hellwig <hch@lst.de>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
Douglas Gilbert <dgilbert@interlog.com>
Subject: Re: [scsi 5/7 RESEND] scsi_debug: schedule_resp fix input variable check
Date: Tue, 25 Aug 2015 15:52:51 -0400 [thread overview]
Message-ID: <1440532371.23183.81.camel@localhost.localdomain> (raw)
In-Reply-To: <1438091666-18113-5-git-send-email-tomas.winkler@intel.com>
On Tue, 2015-07-28 at 16:54 +0300, Tomas Winkler wrote:
> The function should never be called with cmnd NULL so
> put a fat WARN there.
> Fix also smatch wraning:
> schedule_resp() warn: variable dereferenced before check 'cmnd'
>
> Cc: Douglas Gilbert <dgilbert@interlog.com>
> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
> Acked-by: Douglas Gilbert <dgilbert@interlog.com>
> ---
> drivers/scsi/scsi_debug.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
> index 3a70683cf9f9..faa4ddd8decf 100644
> --- a/drivers/scsi/scsi_debug.c
> +++ b/drivers/scsi/scsi_debug.c
> @@ -3941,13 +3941,20 @@ schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip,
> unsigned long iflags;
> int k, num_in_q, qdepth, inject;
> struct sdebug_queued_cmd *sqcp = NULL;
> - struct scsi_device *sdp = cmnd->device;
> + struct scsi_device *sdp;
> +
> + /* this should never happen */
> + if (WARN_ON(!cmnd))
> + return SCSI_MLQUEUE_HOST_BUSY;
>
> - if (NULL == cmnd || NULL == devip) {
> - pr_warn("called with NULL cmnd or devip pointer\n");
> + if (NULL == devip) {
> + pr_warn("called devip == NULL\n");
> /* no particularly good error to report back */
> return SCSI_MLQUEUE_HOST_BUSY;
> }
Please refer to the patch I just posted, we can't return _HOST_BUSY here
if devip == NULL. I posted a fix against the current "misc" branch as
I don't see this patch applied, let me know if I need to update it.
> +
> + sdp = cmnd->device;
> +
> if ((scsi_result) && (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts))
> sdev_printk(KERN_INFO, sdp, "%s: non-zero result=0x%x\n",
> __func__, scsi_result);
next prev parent reply other threads:[~2015-08-25 19:52 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-28 13:54 [scsi 1/7 RESEND] scsi_debug: define pr_fmt() for consistent logging Tomas Winkler
2015-07-28 13:54 ` [scsi 2/7 RESEND] scsi_debug: use SCSI_W_LUN_REPORT_LUNS instead of SAM2_WLUN_REPORT_LUNS; Tomas Winkler
2015-07-30 17:22 ` Martin K. Petersen
2015-07-28 13:54 ` [scsi 3/7 RESEND] scsi_debug: vfree is null safe so drop the check Tomas Winkler
2015-07-30 17:22 ` Martin K. Petersen
2015-07-28 13:54 ` [scsi 4/7 RESEND] scsi_debug: make dump_sector static Tomas Winkler
2015-07-30 17:22 ` Martin K. Petersen
2015-07-28 13:54 ` [scsi 5/7 RESEND] scsi_debug: schedule_resp fix input variable check Tomas Winkler
2015-07-30 17:23 ` Martin K. Petersen
2015-08-25 19:52 ` Ewan Milne [this message]
2015-08-25 21:03 ` Winkler, Tomas
2015-08-25 21:03 ` Winkler, Tomas
2015-08-26 23:38 ` James Bottomley
2015-08-27 19:56 ` Ewan Milne
2015-08-30 10:36 ` Winkler, Tomas
2015-08-30 10:36 ` Winkler, Tomas
2015-08-30 16:54 ` James Bottomley
2015-08-31 8:07 ` Winkler, Tomas
2015-08-31 8:07 ` Winkler, Tomas
2015-07-28 13:54 ` [scsi 6/7 RESEND] scsi_debug: fix REPORT LUNS Well Known LU Tomas Winkler
2015-07-30 17:24 ` Martin K. Petersen
2015-07-28 13:54 ` [scsi 7/7] scsi_debug: resp_request: remove unused variable Tomas Winkler
2015-07-30 17:24 ` Martin K. Petersen
2015-07-30 17:24 ` Martin K. Petersen
2015-07-30 17:21 ` [scsi 1/7 RESEND] scsi_debug: define pr_fmt() for consistent logging Martin K. Petersen
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=1440532371.23183.81.camel@localhost.localdomain \
--to=emilne@redhat.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=dgilbert@interlog.com \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=tomas.winkler@intel.com \
/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.