public inbox for linux-hyperv@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: parri.andrea@gmail.com
Cc: linux-hyperv@vger.kernel.org
Subject: [bug report] hv_netvsc: Copy packets sent by Hyper-V out of the receive buffer
Date: Wed, 3 Feb 2021 13:10:41 +0300	[thread overview]
Message-ID: <YBp2oVIdMe+G/liJ@mwanda> (raw)

Hello Andrea Parri (Microsoft),

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

The patch 0ba35fe91ce3: "hv_netvsc: Copy packets sent by Hyper-V out
of the receive buffer" from Jan 26, 2021, leads to the following
Smatch complaint:

    drivers/net/hyperv/rndis_filter.c:468 rsc_add_data()
    error: we previously assumed 'csum_info' could be null (see line 460)

drivers/net/hyperv/rndis_filter.c
   459			}
   460			if (csum_info != NULL) {
                            ^^^^^^^^^^^^^^^^^
"csum_info" can be NULL.

   461				memcpy(&nvchan->rsc.csum_info, csum_info, sizeof(*csum_info));
   462				nvchan->rsc.ppi_flags |= NVSC_RSC_CSUM_INFO;
   463			} else {
   464				nvchan->rsc.ppi_flags &= ~NVSC_RSC_CSUM_INFO;
   465			}
   466			nvchan->rsc.pktlen = len;
   467			if (hash_info != NULL) {
   468				nvchan->rsc.csum_info = *csum_info;
                                                        ^^^^^^^^^^^
Unchecked dereference.  Plus this has "csum_info" on both sides of the
assignment so maybe it is a copy and paste error?  This is equivalent to
the "memcpy(&nvchan->rsc.csum_info, csum_info, sizeof(*csum_info));"
in the ealier if statement but stated as an assignment instead of a
memcpy().

   469				nvchan->rsc.ppi_flags |= NVSC_RSC_HASH_INFO;
   470			} else {

regards,
dan carpenter

             reply	other threads:[~2021-02-03 10:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-03 10:10 Dan Carpenter [this message]
2021-02-03 10:45 ` [bug report] hv_netvsc: Copy packets sent by Hyper-V out of the receive buffer Andrea Parri
2021-02-03 14:37   ` Andrea Parri

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=YBp2oVIdMe+G/liJ@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=parri.andrea@gmail.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