Message ID | 20210428120010.337959-1-colin.king@canonical.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 12c2bb96c3f1916624d671904430b7714b48dd71 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [next] net: dsa: ksz: Make reg_mib_cnt a u8 as it never exceeds 255 | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Guessed tree name to be net-next |
netdev/subject_prefix | warning | Target tree name not specified in the subject |
netdev/cc_maintainers | success | CCed 11 of 11 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 8 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
On 4/28/2021 5:00 AM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Currently the for-loop in ksz8_port_init_cnt is causing a static > analysis infinite loop warning with the comparison of > mib->cnt_ptr < dev->reg_mib_cnt. This occurs because mib->cnt_ptr > is a u8 and dev->reg_mib_cnt is an int and the analyzer determines > that mib->cnt_ptr potentially can wrap around to zero if the value > in dev->reg_mib_cnt is > 255. However, this value is never this > large, it is always less than 256 so make reg_mib_cnt a u8. Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Hello: This patch was applied to netdev/net-next.git (refs/heads/master): On Wed, 28 Apr 2021 13:00:10 +0100 you wrote: > From: Colin Ian King <colin.king@canonical.com> > > Currently the for-loop in ksz8_port_init_cnt is causing a static > analysis infinite loop warning with the comparison of > mib->cnt_ptr < dev->reg_mib_cnt. This occurs because mib->cnt_ptr > is a u8 and dev->reg_mib_cnt is an int and the analyzer determines > that mib->cnt_ptr potentially can wrap around to zero if the value > in dev->reg_mib_cnt is > 255. However, this value is never this > large, it is always less than 256 so make reg_mib_cnt a u8. > > [...] Here is the summary with links: - [next] net: dsa: ksz: Make reg_mib_cnt a u8 as it never exceeds 255 https://git.kernel.org/netdev/net-next/c/12c2bb96c3f1 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h index e0bbdca64375..2e6bfd333f50 100644 --- a/drivers/net/dsa/microchip/ksz_common.h +++ b/drivers/net/dsa/microchip/ksz_common.h @@ -69,7 +69,7 @@ struct ksz_device { int cpu_ports; /* port bitmap can be cpu port */ int phy_port_cnt; int port_cnt; - int reg_mib_cnt; + u8 reg_mib_cnt; int mib_cnt; const struct mib_names *mib_names; phy_interface_t compat_interface;