Skip to contentSkip to conversation

tc_util: Fix no error return when large parent id used

PATCH Applied Lai Peter Jun Ann 4 participants 4 messages Nov 17, 2022 – Nov 23, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tc_util: Fix no error return when large parent id used

This patch is to fix the issue where there is no error return when large value of parent ID is being used. The return value by stroul() is unsigned long int. Hence the datatype for maj and min should defined as unsigned long to avoid overflow issue.

---
 tc/tc_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tc/tc_util.c +1 -1
index 44137ad..334334d 100644
@@ -93,7 +93,7 @@ ok:
 
 int get_tc_classid(__u32 *h, const char *str)
 {
-	__u32 maj, min;
+	unsigned long maj, min;
 	char *p;
 
 	maj = TC_H_ROOT;
Signature · 1 line
1.9.1
#1 lore raw
Quoted 7 lines · On Thu, 17 Nov 2022 13:33:17 +0800 Lai Peter Jun Ann <[email protected]>…

This patch is to fix the issue where there is no error return when large value of parent ID is being used. The return value by stroul() is unsigned long int. Hence the datatype for maj and min should defined as unsigned long to avoid overflow issue.

Yes, looks good. Will apply to main.
What about qdisc_handle as well?

#2 lore raw

Hi,

Quoted 19 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Friday, November 18, 2022 12:36 AM
To: Lai, Peter Jun Ann <[email protected]>
Cc: [email protected]; David Ahern <[email protected]>; Gomes, Vinicius <[email protected]>; Jamal Hadi Salim <[email protected]>; Cong Wang <[email protected]>; Jiri Pirko <[email protected]>; Zulkifli, Muhammad Husaini <[email protected]>
Subject: Re: [PATCH iproute2-next v1] tc_util: Fix no error return when large parent id used

Quoted 5 lines · On Thu, 17 Nov 2022 13:33:17 +0800 Lai Peter Jun Ann <[email protected]>…

This patch is to fix the issue where there is no error return when large value of parent ID is being used. The return value by stroul() is unsigned long int. Hence the datatype for maj and min should defined as unsigned long to avoid overflow issue.

Quoted 6 lines
Quoted 3 lines

Signed-off-by: Muhammad Husaini Zulkifli
<[email protected]>

Yes, looks good. Will apply to main.
What about qdisc_handle as well?

Thanks for prompt response.
I will submit another patch for qdisc_handle.

#3 lore raw
In reply to Lai Peter Jun Ann
This patch was applied to iproute2/iproute2.git (main) by Stephen Hemminger <[email protected]>:

Hello:

This patch was applied to iproute2/iproute2.git (main) by Stephen Hemminger <[email protected]>:

Quoted 9 lines · On Thu, 17 Nov 2022 13:33:17 +0800 you wrote:

This patch is to fix the issue where there is no error return when large value of parent ID is being used. The return value by stroul() is unsigned long int. Hence the datatype for maj and min should defined as unsigned long to avoid overflow issue.

[...]

Here is the summary with links:
- [iproute2-next,v1] tc_util: Fix no error return when large parent id used
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=e0ecee3a33af

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html