linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <dan.carpenter@oracle.com>
To: <varun@chelsio.com>
Cc: linux-scsi@vger.kernel.org
Subject: [bug report] scsi: cxgb4i: Add support for iSCSI segmentation offload
Date: Fri, 10 Jul 2020 17:17:29 +0300	[thread overview]
Message-ID: <20200710141729.GA135776@mwanda> (raw)

Hello Varun Prakash,

This is a semi-automatic email about new static checker warnings.

The patch e33c2482289b: "scsi: cxgb4i: Add support for iSCSI 
segmentation offload" from Jun 29, 2020, leads to the following 
Smatch complaint:

    drivers/scsi/cxgbi/libcxgbi.c:2158 cxgbi_conn_init_pdu()
    warn: variable dereferenced before check 'tdata' (see line 2150)

drivers/scsi/cxgbi/libcxgbi.c
  2149		struct cxgbi_task_data *tdata = iscsi_task_cxgbi_data(task);
  2150		struct sk_buff *skb = tdata->skb;
                                      ^^^^^^^^^^
The old code doesn't check for NULL.

  2151		struct scsi_cmnd *sc = task->sc;
  2152		u32 expected_count, expected_offset;
  2153		u32 datalen = count, dlimit = 0;
  2154		u32 i, padlen = iscsi_padding(count);
  2155		struct page *pg;
  2156		int err;
  2157	
  2158		if (!tcp_task || !tdata || tcp_task->dd_data != tdata) {
                                 ^^^^^^
The new check is too late.

  2159			pr_err("task 0x%p,0x%p, tcp_task 0x%p, tdata 0x%p/0x%p.\n",
  2160			       task, task->sc, tcp_task,

regards,
dan carpenter

             reply	other threads:[~2020-07-10 14:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-10 14:17 dan.carpenter [this message]
2020-07-10 14:29 ` [bug report] scsi: cxgb4i: Add support for iSCSI segmentation offload Dan Carpenter
2020-07-13 16:41   ` Varun Prakash
  -- strict thread matches above, loose matches on Subject: below --
2020-07-20 10:28 dan.carpenter
2020-07-10 14:14 dan.carpenter
2020-07-13 16:25 ` Varun Prakash

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=20200710141729.GA135776@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=varun@chelsio.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).