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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Sun, 1 Jun 2014 17:41:12 +0200
From:	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
To:	Marcel Holtmann <marcel@...tmann.org>
Cc:	"Gustavo F. Padovan" <gustavo@...ovan.org>,
	Johan Hedberg <johan.hedberg@...il.com>,
	"David S. Miller" <davem@...emloft.net>,
	linux-bluetooth <linux-bluetooth@...r.kernel.org>,
	Network Development <netdev@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net: bluetooth: hci_core.c: Cleaning up uninitialized variables

Hi Marcel!


Sorry sorry!! This is obviously not necessary!

This is code that was left when I tried to split up my original big patch.

This was part of code trying to solve a possible divided by 0.


    int q = 0;

...

    if (num)
        q = cnt / num;
    *quote = q ? q : 1;


But I'm not sure if it can happen in reality...
Guessing it will be caught by in that case by:

    if (!chan)
        return NULL;



I had actually not planned to submit this divided by 0 patch at all :-/


Best regards
Rickard Strandqvist


2014-06-01 16:24 GMT+02:00 Marcel Holtmann <marcel@...tmann.org>:
> Hi Rickard,
>
>> There is a risk that the variable will be used without being initialized.
>>
>> This was largely found by using a static code analysis program called cppcheck.
>>
>> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
>> ---
>> net/bluetooth/hci_core.c |    2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
>> index 1c6ffaa..1d93d2f 100644
>> --- a/net/bluetooth/hci_core.c
>> +++ b/net/bluetooth/hci_core.c
>> @@ -4603,7 +4603,7 @@ static struct hci_chan *hci_chan_sent(struct hci_dev *hdev, __u8 type,
>>       struct hci_chan *chan = NULL;
>>       unsigned int num = 0, min = ~0, cur_prio = 0;
>>       struct hci_conn *conn;
>> -     int cnt, q, conn_num = 0;
>> +     int cnt, q = 0, conn_num = 0;
>
> I have no idea on how the variable will be used without being initialized. Have you actually looked through that function. The only thing we do with q is assign it and then use it. That is it.
>
> Regards
>
> Marcel
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists