lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20190326.125051.1865224055641059773.davem@davemloft.net>
Date:   Tue, 26 Mar 2019 12:50:51 -0700 (PDT)
From:   David Miller <davem@...emloft.net>
To:     mojha@...eaurora.org
Cc:     kjlu@....edu, alexandre.torgue@...com, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        linux-stm32@...md-mailman.stormreply.com, joabreu@...opsys.com,
        mcoquelin.stm32@...il.com, pakki001@....edu,
        peppe.cavallaro@...com, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH] net: stmmac: fix a potential NULL pointer dereference

From: Mukesh Ojha <mojha@...eaurora.org>
Date: Tue, 26 Mar 2019 15:27:03 +0530

> 
> On 3/23/2019 9:09 AM, Kangjie Lu wrote:
>> In case of_device_get_match_data fails, the fix return -EINVAL
>> to avoid the NULL pointer dereference.
>>
>> Signed-off-by: Kangjie Lu <kjlu@....edu>
>> ---
>>   drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
>> b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
>> index 3256e5cbad27..344ead5949b1 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
>> @@ -485,6 +485,8 @@ static int dwc_eth_dwmac_remove(struct
>> platform_device *pdev)
>>   	int err;
>>     	data = of_device_get_match_data(&pdev->dev);
>> +	if (!data)
>> +		return -EINVAL;
> 
> Although, it is false alarm for this driver as of_match_table is not
> NULL, but it would be good to add the check.

I disagree.

This is adding a check just for the sake of adding the check and
shutting up a static analysis tool.

Now, if the tool looked at the table entries being fed into this
function, and found such a posibility then we would fix the bug
and still not add the check.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ