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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 15 May 2023 14:08:22 +0300
From:   Kalle Valo <kvalo@...nel.org>
To:     Daniel Golle <daniel@...rotopia.org>
Cc:     Simon Horman <simon.horman@...igine.com>,
        linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
        linux-mediatek@...ts.infradead.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Felix Fietkau <nbd@....name>,
        Lorenzo Bianconi <lorenzo@...nel.org>,
        Ryder Lee <ryder.lee@...iatek.com>,
        Shayne Chen <shayne.chen@...iatek.com>,
        Sean Wang <sean.wang@...iatek.com>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Matthias Brugger <matthias.bgg@...il.com>,
        AngeloGioacchino Del Regno 
        <angelogioacchino.delregno@...labora.com>,
        Alexander Couzens <lynxis@...0.eu>,
        Sujuan Chen <sujuan.chen@...iatek.com>,
        Bo Jiao <bo.jiao@...iatek.com>,
        Nicolas Cavallari <nicolas.cavallari@...en-communications.fr>,
        Howard Hsu <howard-yh.hsu@...iatek.com>,
        MeiChia Chiu <MeiChia.Chiu@...iatek.com>,
        Peter Chiu <chui-hao.chiu@...iatek.com>,
        Johannes Berg <johannes.berg@...el.com>,
        Wang Yufen <wangyufen@...wei.com>,
        Lorenz Brun <lorenz@...n.one>
Subject: Re: [PATCH] wifi: mt76: mt7915: add support for MT7981

Daniel Golle <daniel@...rotopia.org> writes:

> On Sun, May 14, 2023 at 04:53:43PM +0200, Simon Horman wrote:
>> On Sat, May 13, 2023 at 03:35:51PM +0200, Daniel Golle wrote:
>> > From: Alexander Couzens <lynxis@...0.eu>
>> > 
>> > Add support for the MediaTek MT7981 SoC which is similar to the MT7986
>> > but with a newer IP cores and only 2x ARM Cortex-A53 instead of 4x.
>> > Unlike MT7986 the MT7981 can only connect a single wireless frontend,
>> > usually MT7976 is used for DBDC.
>> > 
>> > Signed-off-by: Alexander Couzens <lynxis@...0.eu>
>> > Signed-off-by: Daniel Golle <daniel@...rotopia.org>
>> 
>> ...
>> 
>> > @@ -489,7 +516,10 @@ static int mt7986_wmac_adie_patch_7976(struct mt7915_dev *dev, u8 adie)
>> >  		rg_xo_01 = 0x1d59080f;
>> >  		rg_xo_03 = 0x34c00fe0;
>> >  	} else {
>> > -		rg_xo_01 = 0x1959f80f;
>> > +		if (is_mt7981(&dev->mt76))
>> > +			rg_xo_01 = 0x1959c80f;
>> > +		else if (is_mt7986(&dev->mt76))
>> > +			rg_xo_01 = 0x1959f80f;
>> 
>> Hi Daniel,
>> 
>> 		rg_xo_01 will be used uninitialised below if we get here
>> 		and neither of the conditions above are true.
>> 
>> 		Can this occur?
>
> No, it cannot occur. Either of is_mt7981() or is_mt7986() will return
> true, as the driver is bound via one of the two compatibles
> 'mediatek,mt7986-wmac' or newly added 'mediatek,mt7981-wmac'.
> Based on that the match_data is either 0x7986 or 0x7981, which is then
> used as chip_id, which is used by the is_mt7981() and is_mt7986()
> functions.

But what if later more changes are made, for example a third compatible
is added? It would be good to add a warning or something else to protect
that.

And I would not be a surpised if a compiler or static analyser would
even warn about the uninitialised variable.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ