Coverity: mt7996_mcu_ie_countdown(): Insecure data handling

coverity-bot keescook at chromium.org
Fri Dec 2 14:27:57 PST 2022


Hello!

This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20221202 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:

  Thu Dec 1 17:29:14 2022 +0100
    98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")

Coverity reported the following:

*** CID 1527797:  Insecure data handling  (TAINTED_SCALAR)
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:415 in mt7996_mcu_ie_countdown()
409     	struct mt76_phy *mphy = &dev->mt76.phy;
410     	struct mt7996_mcu_rxd *rxd = (struct mt7996_mcu_rxd *)skb->data;
411     	const char *data = (char *)&rxd[1], *tail;
412     	struct header *hdr = (struct header *)data;
413     	struct tlv *tlv = (struct tlv *)(data + 4);
414
vvv     CID 1527797:  Insecure data handling  (TAINTED_SCALAR)
vvv     Using tainted variable "hdr->band" as an index into an array "(*dev).mt76.phys".
415     	if (hdr->band && dev->mt76.phys[hdr->band])
416     		mphy = dev->mt76.phys[hdr->band];
417
418     	tail = skb->data + le16_to_cpu(rxd->len);
419     	while (data + sizeof(struct tlv) < tail && le16_to_cpu(tlv->len)) {
420     		switch (le16_to_cpu(tlv->tag)) {

If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):

Reported-by: coverity-bot <keescook+coverity-bot at chromium.org>
Addresses-Coverity-ID: 1527797 ("Insecure data handling")
Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")

Thanks for your attention!

-- 
Coverity-bot



More information about the linux-arm-kernel mailing list