Search Linux Wireless

Re: [PATCH v2] wifi: rtw89: use u32_encode_bits() to fill MAC quota value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ping-Ke Shih <pkshih@xxxxxxxxxxx> 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 <keescook+coverity-bot@xxxxxxxxxxxx>
> Addresses-Coverity-ID: 1527095 ("Integer handling issues")
> Fixes: e3ec7017f6a2 ("rtw89: add Realtek 802.11ax driver")
> Signed-off-by: Ping-Ke Shih <pkshih@xxxxxxxxxxx>

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@xxxxxxxxxxx/

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




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux