public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexandra Winter <wintera@linux.ibm.com>
To: "Colin King (gmail)" <colin.i.king@gmail.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: Mon, 25 Apr 2022 10:38:12 +0200	[thread overview]
Message-ID: <3572a765-17b4-b2df-e3d5-0d30485c4c67@linux.ibm.com> (raw)
In-Reply-To: <ae612043-0252-e8c3-0773-912f116421c1@gmail.com>



On 24.04.22 20:58, Colin King (gmail) wrote:
> 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

Thank you very much for reporting this, we will provide a patch.

Do you have any special requests for the Reported-by flag? Or is
Reported-by: Colin King (gmail) <colin.i.king@gmail.com>
fine with you?

Kind regards
Alexandra

  reply	other threads:[~2022-04-25  8:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-24 18:58 ctcm: rename READ/WRITE defines to avoid redefinitions Colin King (gmail)
2022-04-25  8:38 ` Alexandra Winter [this message]
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=3572a765-17b4-b2df-e3d5-0d30485c4c67@linux.ibm.com \
    --to=wintera@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=colin.i.king@gmail.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 \
    /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