Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2730443rwb; Fri, 2 Dec 2022 14:15:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf7nFrtTeobbHQAaEdHDhLOEFCmiZiwSKZzvktHV7Av1blJ7tqctAal6lVo7wGNCHmfK/OGZ X-Received: by 2002:a17:906:6809:b0:7c0:cd95:bbaf with SMTP id k9-20020a170906680900b007c0cd95bbafmr2528499ejr.460.1670019353372; Fri, 02 Dec 2022 14:15:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670019353; cv=none; d=google.com; s=arc-20160816; b=oSMsQAETzgPEmEaaCX5OqozVqawufKmz+xQ+uzJMWPu98s97C6+xewQb6i7C4bcFNh 0iCs3ulJyTdQWI0ce9MND4wSHyOrtGwghfAKWQ3aodOTbNR02uDwv6dxIBugv06Hd2fW ZU17oyTvkPf/F69wbWa+PTbr+mdKAR1Co3Dw21tTBwfFOl+JTfbwIgJF03VaJs9xK4Ke pDDG0K6ZByvjeOx6sDCYFCplqLq2JKiYtXf36yv2PAINravI8D69rKJ6YZOsT0jUKXtl jPCztdmjGez6s6Yeu9XYDCFsUaX7evTRxtL3UAb+0YLKpYnZ1HwQjD0x/+5iklVijLxD z5Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:date:from:dkim-signature; bh=w0dcCRAw7breQBxRgO7vXMzRE1EKaCH1sm8fAccBDKk=; b=Csj3oIVQcXmv/IG0xerODKg35U0WFmWNrRWtaxtRvFtDMr1ZAq92dycqSODQ+14Ye+ cPNC7rlzi6jVCnnbwAGou+l6r7g5xPgjUfwRrqP9ohCODeI6t87YbvPOMVyz0qRM79dP NOcmSiuBMkzLlVmd4IpoFao4UioJ3e44mUahFNqsSGlvui0GPUyeTUBB4mbl74ppgNjr dBrJe2ERwxZ43Axa52GvqCuY4t2Q1vg4hOTNEkm1sHPfwK+PO2/zSj+m5bSQl/3dhEOq d/nI3xl3mw3IjyAmCZ2UshbBpNZVhHd9OrreUC1NFFy1VC0Xtp7WycF2Yp62tpVXGnjt M35Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=OwVi+W7x; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn16-20020a17090794d000b007824b85978asi7387570ejc.81.2022.12.02.14.15.33; Fri, 02 Dec 2022 14:15:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=OwVi+W7x; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234532AbiLBWLh (ORCPT + 66 others); Fri, 2 Dec 2022 17:11:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229491AbiLBWLg (ORCPT ); Fri, 2 Dec 2022 17:11:36 -0500 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69849F89A4 for ; Fri, 2 Dec 2022 14:11:35 -0800 (PST) Received: by mail-pl1-x634.google.com with SMTP id p24so5873235plw.1 for ; Fri, 02 Dec 2022 14:11:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-disposition:mime-version:message-id:subject:cc:to:date:from :from:to:cc:subject:date:message-id:reply-to; bh=w0dcCRAw7breQBxRgO7vXMzRE1EKaCH1sm8fAccBDKk=; b=OwVi+W7xvxR/nGjj39pmX3oRQiji/LPiwOpKAVbcIfM5DiCUEx2CVjjGCPgXGrAYj2 5UoXRgnzXLZKAL8W05vLqFxBXlQ6XcoYM3KtBnvhqQMVng3lNY2A1Ac0VfEk1e+mkKH0 2KCcNECGN1AEN2hcX554Bmw8qWfXqc5l8cIxA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:date:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=w0dcCRAw7breQBxRgO7vXMzRE1EKaCH1sm8fAccBDKk=; b=eyyhCW2unAPTADNlJhNlJ5dUYLAA2Dqf93ecJ36auSIVmZJYID/mL7cOPPXIF3Qgcz oRmgzmaiuop3zNJkSgrbk4zz7YIo4OfqC27kH+4TagqTK1EQO5OFo9Rx3+0l7uZ16ihV Mr1MT2wOzUElvdoCjTFK2U7WZbUoRuel9w8MPXetRTARzbleaGGnF5gX+H4wa5VVwwLd nHqQo+dnWFhmDbHBzg4qg4iRj/YF1abwulyNx8qLUTP6hvFIiRGxxvbYzQj+wSQqT6Y3 eH5lpQ/snUVdYpTMKwIhDcvMf910zXMiPk3y1mBNXZs3LD6Yf7uoH3bUNOVTGR2Ouav1 T9SA== X-Gm-Message-State: ANoB5pk3JFFNtSffo2R8LVTLtMdlrCu7eKeI/+Hgk9DxSKDTPKFrq25I JYYLPkf4vtHhsNL7fVJCshgEmA== X-Received: by 2002:a17:90a:9e5:b0:219:5139:7fa8 with SMTP id 92-20020a17090a09e500b0021951397fa8mr20815064pjo.15.1670019094904; Fri, 02 Dec 2022 14:11:34 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id h131-20020a628389000000b0056bb36c047asm5510216pfe.105.2022.12.02.14.11.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 14:11:34 -0800 (PST) From: coverity-bot X-Google-Original-From: coverity-bot Date: Fri, 2 Dec 2022 14:11:33 -0800 To: Shayne Chen Cc: Lorenzo Bianconi , linux-wireless@vger.kernel.org, Jakub Kicinski , Kalle Valo , StanleyYP Wang , Matthias Brugger , Peter Chiu , Eric Dumazet , Money Wang , linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, Howard Hsu , linux-mediatek@lists.infradead.org, Felix Fietkau , "David S. Miller" , Evelyn Tsai , linux-kernel@vger.kernel.org, MeiChia Chiu , Paolo Abeni , Sean Wang , Bo Jiao , Ryder Lee , Sujuan Chen , "Gustavo A. R. Silva" , linux-next@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Coverity: mt7996_hw_queue_read(): Integer handling issues Message-ID: <202212021411.A5E618D3@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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 1527813: Integer handling issues (SIGN_EXTENSION) drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c:460 in mt7996_hw_queue_read() 454 for (i = 0; i < size; i++) { 455 u32 ctrl, head, tail, queued; 456 457 if (val & BIT(map[i].index)) 458 continue; 459 vvv CID 1527813: Integer handling issues (SIGN_EXTENSION) vvv Suspicious implicit sign extension: "map[i].qid" with type "u8" (8 bits, unsigned) is promoted in "map[i].qid << 24" to type "int" (32 bits, signed), then sign-extended to type "unsigned long" (64 bits, unsigned). If "map[i].qid << 24" is greater than 0x7FFFFFFF, the upper bits of the result will all be 1. 460 ctrl = BIT(31) | (map[i].pid << 10) | (map[i].qid << 24); 461 mt76_wr(dev, MT_FL_Q0_CTRL, ctrl); 462 463 head = mt76_get_field(dev, MT_FL_Q2_CTRL, 464 GENMASK(11, 0)); 465 tail = mt76_get_field(dev, MT_FL_Q2_CTRL, 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 Addresses-Coverity-ID: 1527813 ("Integer handling issues") Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices") Thanks for your attention! -- Coverity-bot