public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: [bug report] rocker: Add support for learning FDB through notification
Date: Thu, 10 Aug 2017 12:12:52 +0000	[thread overview]
Message-ID: <20170809084715.2do2st52nbok56du@mwanda> (raw)

Hello Arkadi Sharshevsky,

The patch 726fd42fc1e3: "rocker: Add support for learning FDB through
notification" from Jun 8, 2017, leads to the following static checker
warning:

	drivers/net/ethernet/rocker/rocker_main.c:2789 rocker_switchdev_event()
	error: potential null dereference 'switchdev_work->fdb_info.addr'.  (kzalloc returns null)

drivers/net/ethernet/rocker/rocker_main.c
  2779          INIT_WORK(&switchdev_work->work, rocker_switchdev_event_work);
  2780          switchdev_work->rocker_port = rocker_port;
  2781          switchdev_work->event = event;
  2782  
  2783          switch (event) {
  2784          case SWITCHDEV_FDB_ADD_TO_DEVICE: /* fall through */
  2785          case SWITCHDEV_FDB_DEL_TO_DEVICE:
  2786                  memcpy(&switchdev_work->fdb_info, ptr,
  2787                         sizeof(switchdev_work->fdb_info));
  2788                  switchdev_work->fdb_info.addr = kzalloc(ETH_ALEN, GFP_ATOMIC);
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Alloc

  2789                  ether_addr_copy((u8 *)switchdev_work->fdb_info.addr,
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Dereference

  2790                                  fdb_info->addr);
  2791                  /* Take a reference on the rocker device */
  2792                  dev_hold(dev);
  2793                  break;
  2794          default:
  2795                  kfree(switchdev_work);
  2796                  return NOTIFY_DONE;
  2797          }
  2798  
  2799          queue_work(rocker_port->rocker->rocker_owq,
  2800                     &switchdev_work->work);
  2801          return NOTIFY_DONE;
  2802  }

regards,
dan carpenter

                 reply	other threads:[~2017-08-10 12:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20170809084715.2do2st52nbok56du@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox