All of lore.kernel.org
 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: Mon, 20 Jul 2020 13:28:46 +0300	[thread overview]
Message-ID: <20200720102846.GA29932@mwanda> (raw)

Hello Varun Prakash,

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

drivers/scsi/cxgbi/libcxgbi.c:1902 cxgbi_conn_alloc_pdu() warn: 'tdata' can't be NULL.
drivers/scsi/cxgbi/libcxgbi.c:2158 cxgbi_conn_init_pdu() warn: 'tdata' can't be NULL.
drivers/scsi/cxgbi/libcxgbi.c:2374 cxgbi_conn_xmit_pdu() warn: 'tdata' can't be NULL.

drivers/scsi/cxgbi/libcxgbi.c
  1885  int cxgbi_conn_alloc_pdu(struct iscsi_task *task, u8 op)
  1886  {
  1887          struct iscsi_conn *conn = task->conn;
  1888          struct iscsi_session *session = task->conn->session;
  1889          struct iscsi_tcp_conn *tcp_conn = conn->dd_data;
  1890          struct cxgbi_conn *cconn = tcp_conn->dd_data;
  1891          struct cxgbi_device *cdev = cconn->chba->cdev;
  1892          struct cxgbi_sock *csk = cconn->cep ? cconn->cep->csk : NULL;
  1893          struct iscsi_tcp_task *tcp_task = task->dd_data;
  1894          struct cxgbi_task_data *tdata = iscsi_task_cxgbi_data(task);
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#define iscsi_task_cxgbi_data(task) \
        ((task)->dd_data + sizeof(struct iscsi_tcp_task))

  1895          struct scsi_cmnd *sc = task->sc;
  1896          u32 headroom = SKB_TX_ISCSI_PDU_HEADER_MAX;
  1897          u32 max_txdata_len = conn->max_xmit_dlength;
  1898          u32 iso_tx_rsvd = 0, local_iso_info = 0;
  1899          u32 last_tdata_offset, last_tdata_count;
  1900          int err = 0;
  1901  
  1902          if (!tcp_task || !tdata) {
                                 ^^^^^^
If ->dd_data is negative sizeof(struct iscsi_tcp_task) then we are
toasted.  That's an error pointer.  These sorts of extra NULL checking
generate a warning because maybe we intended to check a different
variable or IS_ERR(task->dd_data) or something.  The checker can't know.

  1903                  pr_err("task 0x%p, tcp_task 0x%p, tdata 0x%p.\n",
  1904                         task, tcp_task, tdata);
  1905                  return -ENOMEM;
  1906          }

regards,
dan carpenter

             reply	other threads:[~2020-07-20 10:28 UTC|newest]

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