lkml.org 
[lkml]   [2022]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectre: ctcm: rename READ/WRITE defines to avoid redefinitions
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

\
 
 \ /
  Last update: 2022-04-24 20:58    [W:1.174 / U:0.964 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site