Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp102799rwb; Tue, 8 Nov 2022 23:06:37 -0800 (PST) X-Google-Smtp-Source: AMsMyM6lNJkwxnM9FeAn2WDjf/VHVjabeIqYqRWmuHwh7o0w0xoIKXmdFSXV4XKs6uCPYMdTiqoO X-Received: by 2002:a17:907:6e9e:b0:78e:214b:e3c2 with SMTP id sh30-20020a1709076e9e00b0078e214be3c2mr55354033ejc.15.1667977597029; Tue, 08 Nov 2022 23:06:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667977597; cv=none; d=google.com; s=arc-20160816; b=qGSkHt2tlp3vPK6n6xKhXO57bpPVYQ45yW5kBFuaz66DRvEMPPzyjTgON4TJq+TFh7 g4CYdfZjsgSkIdHD3KNdlfMXoyp91jgOeuTSNzNacppkrVpPmBnpxRpq+kiga+n6tYgE Deig7SDixTFYCN7CQEjpB+RaWCsmqoZRjIPYyK4Vvrz9saEJFS6Y0/Xdla+D5iUfTFeD PVgI7TmESysuYn9kTYNAwROJaWE86fUJLj0BNzr87R4aWajxbpwafAcS5x1TkaEEWZQZ yZ2hQVJd9FYxWD45PPvDeOLH2BvtwUwxOYNO3u5bjim40zvTNoe2psXACcATJW8GjFkr ZsXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:message-id:user-agent:cc:to:references :in-reply-to:from:subject:content-transfer-encoding:mime-version :dkim-signature; bh=BKITGEPuC8XKeun2YrTiUY84t09MycpIXsw7O4SnjOI=; b=ugP4PggxIOLiRbUdWdlvcJp7UnbTUjlaeE6lYEMRSnQj/k3ssivIoUDc7Ku0rf8Nuf 4y5xmDt5JgkTa8ymA716U+22rupMx0D0FbRhiKypjDsUGc+pVY4hSjrzgDtyvRtebAnt ycpbO/ehrlZbdKPqXDI4QzjOYAFptrVTm6YJDJsu+2pvDBmN+AodDBIE/CF9Lof1bwN9 uwln79ep+MUgslmXbuypdACRKreY3O+v4Qq8wKxZ0VDGRQxo5KFMjDtEfdtcPlw4BjN4 GyN4PavDESw4WYlREc+Z9evuKhx+kkCRk0Q2BPWCxvWsVBXZJ3iOn+yMwczk+08oe+Vi tYgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Jaq7rHS9; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs9-20020a1709072d0900b007ae50c64522si13668551ejc.520.2022.11.08.23.06.15; Tue, 08 Nov 2022 23:06:37 -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=@kernel.org header.s=k20201202 header.b=Jaq7rHS9; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229617AbiKIHBJ (ORCPT + 67 others); Wed, 9 Nov 2022 02:01:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229517AbiKIHBI (ORCPT ); Wed, 9 Nov 2022 02:01:08 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2186663B1 for ; Tue, 8 Nov 2022 23:01:06 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B3844618CD for ; Wed, 9 Nov 2022 07:01:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89950C433C1; Wed, 9 Nov 2022 07:01:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667977265; bh=IoFJ2E7NZkc7U7TYBpbz+tb+o8mpqRW/zCmCsG6TNLw=; h=Subject:From:In-Reply-To:References:To:Cc:Date:From; b=Jaq7rHS9WjJCEwCeW7rmDQHphlXjmjCkmgwu/twZ1EaikF5WRf23fMcr+JQS0S6+w Gv1+tMwPW+g+QoH9WH8G0k58tBIpktUfBb87SfKtA2rwjt2ulT9Lv+VuO0GaRHoJ6R 4NSRjNgjp2YM4gkvAG6B1/F9xku09rCQmlC5mfFZzIjfelTktA78qlc6SzEGc+g9xD O2WV3XVFlpEL8r0He83eVgdUq3pQhCR0hpEoNneotL87T6arSq+RpmqUHOmkf+vnYe OZpLFJ/AQJlldXjDMxRhpXs8gw9T6rmxoW9ckRmTYeqGh12pgMeKq7MXrS7C+YxLoJ DWFKSaNAXx0Tg== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PATCH v2] wifi: rtw89: use u32_encode_bits() to fill MAC quota value From: Kalle Valo In-Reply-To: <20221108013858.10806-1-pkshih@realtek.com> References: <20221108013858.10806-1-pkshih@realtek.com> To: Ping-Ke Shih Cc: User-Agent: pwcli/0.1.1-git (https://github.com/kvalo/pwcli/) Python/3.7.3 Message-ID: <166797725268.32472.8691659349990605066.kvalo@kernel.org> Date: Wed, 9 Nov 2022 07:01:04 +0000 (UTC) X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Ping-Ke Shih wrote: > Coverity reported shift 16 bits could cause sign extension and might get > an unexpected value. Since the input values are predefined and no this > kind of case, original code is safe so far. But, still changing them to > use u32_encode_bits() will be more clear and prevent mistakes in the > future. > > The original message of Coverity is: > Suspicious implicit sign extension: "max_cfg->cma0_dma" with type "u16" > (16 bits, unsigned) is promoted in "max_cfg->cma0_dma << 16" to type > "int" (32 bits, signed), then sign-extended to type "unsigned long" > (64 bits, unsigned). If "max_cfg->cma0_dma << 16" is greater than > 0x7FFFFFFF, the upper bits of the result will all be 1." > > Reported-by: coverity-bot > Addresses-Coverity-ID: 1527095 ("Integer handling issues") > Fixes: e3ec7017f6a2 ("rtw89: add Realtek 802.11ax driver") > Signed-off-by: Ping-Ke Shih Patch applied to wireless-next.git, thanks. 525c06c81d75 wifi: rtw89: use u32_encode_bits() to fill MAC quota value -- https://patchwork.kernel.org/project/linux-wireless/patch/20221108013858.10806-1-pkshih@realtek.com/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches