public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: "Colin King (gmail)" <colin.i.king@gmail.com>
To: Alexandra Winter <wintera@linux.ibm.com>,
	Wenjia Zhang <wenjia@linux.ibm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>,
	linux-s390@vger.kernel.org,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: re: ctcm: rename READ/WRITE defines to avoid redefinitions
Date: Sun, 24 Apr 2022 19:58:02 +0100	[thread overview]
Message-ID: <ae612043-0252-e8c3-0773-912f116421c1@gmail.com> (raw)

Hi,

static analysis with cppcheck detected a potential null pointer 
deference with the following commit:

commit 3c09e2647b5e1f1f9fd383971468823c2505e1b0
Author: Ursula Braun <ursula.braun@de.ibm.com>
Date:   Thu Aug 12 01:58:28 2010 +0000

     ctcm: rename READ/WRITE defines to avoid redefinitions


The analysis is as follows:

drivers/s390/net/ctcm_sysfs.c:43:8: note: Assuming that condition 'priv' 
is not redundant
  if (!(priv && priv->channel[CTCM_READ] && ndev)) {
        ^
drivers/s390/net/ctcm_sysfs.c:42:9: note: Null pointer dereference
  ndev = priv->channel[CTCM_READ]->netdev;

The code in question is as follows:

         ndev = priv->channel[CTCM_READ]->netdev;

         ^^ priv may be null, as per check below but it is being 
dereferenced when assigning ndev

         if (!(priv && priv->channel[CTCM_READ] && ndev)) {
                 CTCM_DBF_TEXT(SETUP, CTC_DBF_ERROR, "bfnondev");
                 return -ENODEV;
         }

Colin

             reply	other threads:[~2022-04-24 18:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-24 18:58 Colin King (gmail) [this message]
2022-04-25  8:38 ` ctcm: rename READ/WRITE defines to avoid redefinitions Alexandra Winter
2022-04-25  9:01   ` Colin King (gmail)

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=ae612043-0252-e8c3-0773-912f116421c1@gmail.com \
    --to=colin.i.king@gmail.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=wenjia@linux.ibm.com \
    --cc=wintera@linux.ibm.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