All of lore.kernel.org
 help / color / mirror / Atom feed
* re: ctcm: rename READ/WRITE defines to avoid redefinitions
@ 2022-04-24 18:58 Colin King (gmail)
  2022-04-25  8:38 ` Alexandra Winter
  0 siblings, 1 reply; 3+ messages in thread
From: Colin King (gmail) @ 2022-04-24 18:58 UTC (permalink / raw)
  To: Alexandra Winter, Wenjia Zhang, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev
  Cc: Christian Borntraeger, linux-s390, netdev, linux-kernel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ctcm: rename READ/WRITE defines to avoid redefinitions
  2022-04-24 18:58 ctcm: rename READ/WRITE defines to avoid redefinitions Colin King (gmail)
@ 2022-04-25  8:38 ` Alexandra Winter
  2022-04-25  9:01   ` Colin King (gmail)
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandra Winter @ 2022-04-25  8:38 UTC (permalink / raw)
  To: Colin King (gmail),
	Wenjia Zhang, Heiko Carstens, Vasily Gorbik, Alexander Gordeev
  Cc: Christian Borntraeger, linux-s390, netdev, linux-kernel



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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ctcm: rename READ/WRITE defines to avoid redefinitions
  2022-04-25  8:38 ` Alexandra Winter
@ 2022-04-25  9:01   ` Colin King (gmail)
  0 siblings, 0 replies; 3+ messages in thread
From: Colin King (gmail) @ 2022-04-25  9:01 UTC (permalink / raw)
  To: Alexandra Winter, Wenjia Zhang, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev
  Cc: Christian Borntraeger, linux-s390, netdev, linux-kernel

On 25/04/2022 09:38, Alexandra Winter wrote:
> 
> 
> 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.

Thanks for working on a fix. Much appreciated.

> 
> 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?
> 

Can I have:

Reported by: Colin Ian King <colin.i.king@gmail.com>

Thank you!

Colin

> Kind regards
> Alexandra


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-25  9:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-24 18:58 ctcm: rename READ/WRITE defines to avoid redefinitions Colin King (gmail)
2022-04-25  8:38 ` Alexandra Winter
2022-04-25  9:01   ` Colin King (gmail)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.