Fix kernel test robot issue and type error in min_t
Subsystems (3)
Justin Lai
maintainerv2 cover Fix kernel test robot issue and type error in min_t
This patch set mainly involves fixing the kernel test robot issue and the type error in min_t.
Details are as follows:
1. Fix the compile error reported by the kernel test robot
2. Fix the compile warning reported by the kernel test robot
3. Fix a type error in min_t
v1 -> v2:
Nothing has changed, and it is simply being posted again because the initial version was posted incompletely.
Justin Lai (3):
rtase: Fix the compile error reported by the kernel test robot
rtase: Fix the compile warning reported by the kernel test robot
rtase: Fix a type error in min_t
drivers/net/ethernet/realtek/rtase/rtase.h | 2 +- drivers/net/ethernet/realtek/rtase/rtase_main.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)
Signature · 1 line
2.34.1
Justin Lai
maintainerPATCH v2 1/3 rtase: Fix the compile error reported by the kernel test robot
Fix the following compile error reported by the kernel test robot by modifying the condition used to detect overflow in rtase_calc_time_mitigation.
In file included from include/linux/mdio.h:10:0,
from drivers/net/ethernet/realtek/rtase/rtase_main.c:58:
In function 'u16_encode_bits',
inlined from 'rtase_calc_time_mitigation.constprop' at drivers/net/ ethernet/realtek/rtase/rtase_main.c:1915:13,
inlined from 'rtase_init_software_variable.isra.41' at drivers/net/ ethernet/realtek/rtase/rtase_main.c:1961:13,
inlined from 'rtase_init_one' at drivers/net/ethernet/realtek/ rtase/rtase_main.c:2111:2:
Quoted 1 line
Quoted 1 line
include/linux/bitfield.h:178:3: error: call to '__field_overflow'
declared with attribute error: value doesn't fit into mask
__field_overflow(); \
^~~~~~~~~~~~~~~~~~ include/linux/bitfield.h:198:2: note: in expansion of macro '____MAKE_OP'
____MAKE_OP(u##size,u##size,,)
^~~~~~~~~~~
include/linux/bitfield.h:200:1: note: in expansion of macro '__MAKE_OP'
__MAKE_OP(16)
^~~~~~~~~
--- drivers/net/ethernet/realtek/rtase/rtase_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/realtek/rtase/rtase_main.c +2 -2
@@ -1925,8 +1925,8 @@ static u16 rtase_calc_time_mitigation(u32 time_us) time_us =min_t (int, time_us,RTASE_MITI_MAX_TIME ); - msb =fls (time_us); -if (msb >=RTASE_MITI_COUNT_BIT_NUM ) { +if (time_us >RTASE_MITI_TIME_COUNT_MASK ) { + msb =fls (time_us); time_unit = msb -RTASE_MITI_COUNT_BIT_NUM ; time_count = time_us >> (msb -RTASE_MITI_COUNT_BIT_NUM ); }else {
Signature · 1 line
2.34.1
Re: [PATCH net v2 1/3] rtase: Fix the compile error reported by the kernel test robot
Quoted 3 lines · Justin Lai
Fix the following compile error reported by the kernel test robot by modifying the condition used to detect overflow in
rtase_calc_time_mitigation.
The Subject: line is not very useful. It is better to talk about what you are fixing, not that a robot reported an issue.
Andrew
---
pw-bot: cr
Justin Lai
maintainerRE: [PATCH net v2 1/3] rtase: Fix the compile error reported by the kernel test robot
Quoted 6 lines · Justin Lai
Quoted 3 lines
Fix the following compile error reported by the kernel test robot by modifying the condition used to detect overflow in
rtase_calc_time_mitigation.
Quoted 7 lines
The Subject: line is not very useful. It is better to talk about what you are fixing, not that a robot reported an issue.
Andrew
---
pw-bot: cr
Hi Andrew,
Thank you for your response. I will modify the subject and post a new version.
Thanks,
Justin
Justin Lai
maintainerPATCH v2 2/3 rtase: Fix the compile warning reported by the kernel test robot
In reply to Justin LaiFix the following compile warning reported by the kernel test robot by increasing the size of ivec->name.
drivers/net/ethernet/realtek/rtase/rtase_main.c: In function 'rtase_open':
Quoted 1 line
Quoted 1 line
drivers/net/ethernet/realtek/rtase/rtase_main.c:1117:52: warning:
'%i' directive output may be truncated writing between 1 and 10 bytes into a region of size between 7 and 22 [-Wformat-truncation=]
snprintf(ivec->name, sizeof(ivec->name), "%s_int%i",
^~
drivers/net/ethernet/realtek/rtase/rtase_main.c:1117:45: note:
directive argument in the range [0, 2147483647]
snprintf(ivec->name, sizeof(ivec->name), "%s_int%i",
^~~~~~~~~~
drivers/net/ethernet/realtek/rtase/rtase_main.c:1117:4: note:
'snprintf' output between 6 and 30 bytes into a destination of
size 26
snprintf(ivec->name, sizeof(ivec->name), "%s_int%i",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tp->dev->name, i);
~~~~~~~~~~~~~~~~~--- drivers/net/ethernet/realtek/rtase/rtase.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/realtek/rtase/rtase.h +1 -1
@@ -259,7 +259,7 @@ union rtase_rx_desc {#define RTASE_VLAN_TAG_MASK GENMASK(15, 0)#define RTASE_RX_PKT_SIZE_MASK GENMASK(13, 0) -#define RTASE_IVEC_NAME_SIZE (IFNAMSIZ + 10) +#define RTASE_IVEC_NAME_SIZE (IFNAMSIZ + 14)struct rtase_int_vector {struct rtase_private *tp;
Signature · 1 line
2.34.1
Justin Lai
maintainerPATCH v2 3/3 rtase: Fix a type error in min_t
In reply to Justin LaiFix a type error in min_t.
--- drivers/net/ethernet/realtek/rtase/rtase_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/realtek/rtase/rtase_main.c +2 -2
@@ -1923,7 +1923,7 @@ static u16 rtase_calc_time_mitigation(u32 time_us)u8 msb, time_count, time_unit;u16 int_miti; - time_us =min_t (int, time_us,RTASE_MITI_MAX_TIME ); + time_us =min_t (u32, time_us,RTASE_MITI_MAX_TIME );if (time_us >RTASE_MITI_TIME_COUNT_MASK ) { msb =fls (time_us);
@@ -1945,7 +1945,7 @@ static u16 rtase_calc_packet_num_mitigation(u16 pkt_num)u8 msb, pkt_num_count, pkt_num_unit;u16 int_miti; - pkt_num =min_t (int, pkt_num,RTASE_MITI_MAX_PKT_NUM ); + pkt_num =min_t (u16, pkt_num,RTASE_MITI_MAX_PKT_NUM );if (pkt_num >60 ) { pkt_num_unit =RTASE_MITI_MAX_PKT_NUM_IDX ;
Signature · 1 line
2.34.1
Re: [PATCH net v2 3/3] rtase: Fix a type error in min_t
Quoted 4 lines · Justin Lai
Fix a type error in
min_t.Fixes a36e9f5cfe9e ("rtase: Add support for a pci table in this module")Signed-off-by Justin Lai <[email protected]>
Andrew
David Laight
NAKRe: [PATCH net v2 3/3] rtase: Fix a type error in min_t
In reply to Justin LaiQuoted 1 line · On Wed, 16 Apr 2025 20:45:34 +0800 Justin Lai <[email protected]> wrote:
Fix a type error in
min_t.
NAK, in particular u16 is likely to be buggy
Consider what would happen if RTBASE_MITI_MAX_PKT_NUM was 65536. (Yes, I know that isn't the intent of the code...)
As pointed out earlier using min() shouldn't generate a compile warning and won't mask off significant bits.
Also I think it isn't a bug in any sense because the two functions have a single caller that passes a constant.
David
Quoted 29 lines
Fixes a36e9f5cfe9e ("rtase: Add support for a pci table in this module")Signed-off-by Justin Lai <[email protected]>--- drivers/net/ethernet/realtek/rtase/rtase_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/ethernet/realtek/rtase/rtase_main.c +2
-2@@ -1923,7 +1923,7 @@ static u16 rtase_calc_time_mitigation(u32 time_us)u8 msb, time_count, time_unit;u16 int_miti; - time_us =min_t (int, time_us,RTASE_MITI_MAX_TIME ); + time_us =min_t (u32, time_us,RTASE_MITI_MAX_TIME );if (time_us >RTASE_MITI_TIME_COUNT_MASK ) { msb =fls (time_us);@@ -1945,7 +1945,7 @@ static u16 rtase_calc_packet_num_mitigation(u16 pkt_num)u8 msb, pkt_num_count, pkt_num_unit;u16 int_miti; - pkt_num =min_t (int, pkt_num,RTASE_MITI_MAX_PKT_NUM ); + pkt_num =min_t (u16, pkt_num,RTASE_MITI_MAX_PKT_NUM );if (pkt_num >60 ) { pkt_num_unit =RTASE_MITI_MAX_PKT_NUM_IDX ;
Justin Lai
maintainerRE: [PATCH net v2 3/3] rtase: Fix a type error in min_t
Quoted 9 lines
Quoted 1 line · On Wed, 16 Apr 2025 20:45:34 +0800 Justin Lai <[email protected]> wrote:
Fix a type error in
min_t.NAK, in particular u16 is likely to be buggy Consider what would happen if
RTBASE_MITI_MAX_PKT_NUMwas 65536.
(Yes, I know that isn't the intent of the code...)
Quoted 7 lines
As pointed out earlier using
min()shouldn't generate a compile warning and won't mask off significant bits.Also I think it isn't a bug in any sense because the two functions have a single caller that passes a constant.
David
Hi David,
This is indeed not a bug fix, and I have modified it to use min instead of min_t, and posted it to net-next.
Thanks,
Justin
Quoted 35 lines
drivers/net/ethernet/realtek/rtase/rtase_main.c static u16 rtase_calc_time_mitigation(u32
Quoted 16 lines
Fixes a36e9f5cfe9e ("rtase: Add support for a pci table in thismodule")
Signed-off-by Justin Lai <[email protected]>--- drivers/net/ethernet/realtek/rtase/rtase_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/ethernet/realtek/rtase/rtase_main.c +0
-0@@ -1923,7 +1923,7 @@ static u16 rtase_calc_time_mitigation(u32
time_us)drivers/net/ethernet/realtek/rtase/rtase_main.c static u16 rtase_calc_packet_num_mitigation(u16
Quoted 9 lines
drivers/net/ethernet/realtek/rtase/rtase_main.c +1
-1u8 msb, time_count, time_unit;u16 int_miti; - time_us =min_t (int, time_us,RTASE_MITI_MAX_TIME ); + time_us =min_t (u32, time_us,RTASE_MITI_MAX_TIME );if (time_us >RTASE_MITI_TIME_COUNT_MASK ) { msb =fls (time_us);@@ -1945,7 +1945,7 @@ static u16 rtase_calc_packet_num_mitigation(u16
pkt_num)Quoted 8 lines
drivers/net/ethernet/realtek/rtase/rtase_main.c +1
-1u8 msb, pkt_num_count, pkt_num_unit;u16 int_miti; - pkt_num =min_t (int, pkt_num,RTASE_MITI_MAX_PKT_NUM ); + pkt_num =min_t (u16, pkt_num,RTASE_MITI_MAX_PKT_NUM );if (pkt_num >60 ) { pkt_num_unit =RTASE_MITI_MAX_PKT_NUM_IDX ;