All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: varun@chelsio.com
Cc: target-devel@vger.kernel.org
Subject: [bug report] cxgbit: add files for cxgbit.ko
Date: Fri, 21 Jan 2022 18:21:01 +0300	[thread overview]
Message-ID: <20220121152101.GA4116@kili> (raw)

Hello Varun Prakash,

The patch 9730ffcb8957: "cxgbit: add files for cxgbit.ko" from Apr
20, 2016, leads to the following Smatch static checker warning:

drivers/target/iscsi/cxgbit/cxgbit_cm.c:561 __cxgbit_free_cdev_np()
warn: inconsistent refcounting 'cnp->kref.refcount.refs.counter'
  inc on: 548
  dec on: 542

drivers/target/iscsi/cxgbit/cxgbit_cm.c
   517        static int
   518        __cxgbit_free_cdev_np(struct cxgbit_device *cdev, struct cxgbit_np *cnp)
   519        {
   520                int stid, ret;
   521                bool ipv6 = false;
   522
   523                stid = cxgbit_np_hash_del(cdev, cnp);
   524                if (stid < 0)
   525                        return -EINVAL;
   526                if (!test_bit(CDEV_STATE_UP, &cdev->flags))
   527                        return -EINVAL;
   528
   529                if (cnp->np->np_sockaddr.ss_family == AF_INET6)
   530                        ipv6 = true;
   531
   532                cxgbit_get_cnp(cnp);

get here

   533                cxgbit_init_wr_wait(&cnp->com.wr_wait);
   534                ret = cxgb4_remove_server(cdev->lldi.ports[0], stid,
   535                                          cdev->lldi.rxq_ids[0], ipv6);
   536
   537                if (ret > 0)
   538                        ret = net_xmit_errno(ret);
   539
   540                if (ret) {
   541                        cxgbit_put_cnp(cnp);

put here

   542                        return ret;
   543                }
   544
   545                ret = cxgbit_wait_for_reply(cdev, &cnp->com.wr_wait,
   546                                            0, 10, __func__);
   547                if (ret == -ETIMEDOUT)
   548                        return ret;

Should this error path put as well?

   549
   550                if (ipv6 && cnp->com.cdev) {
   551                        struct sockaddr_in6 *sin6;
   552
   553                        sin6 = (struct sockaddr_in6 *)&cnp->com.local_addr;
   554                        cxgb4_clip_release(cdev->lldi.ports[0],
   555                                           (const u32 *)&sin6->sin6_addr.s6_addr,
   556                                           1);
   557                }
   558
   559                cxgb4_free_stid(cdev->lldi.tids, stid,
   560                                cnp->com.local_addr.ss_family);
   561                return 0;


regards,
dan carpenter

             reply	other threads:[~2022-01-21 15:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-21 15:21 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-01-23 14:05 [bug report] cxgbit: add files for cxgbit.ko Dan Carpenter
2018-01-29 14:49 ` Varun Prakash
2018-01-30  2:38 ` Dan Carpenter

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=20220121152101.GA4116@kili \
    --to=dan.carpenter@oracle.com \
    --cc=target-devel@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.