From: Ido Schimmel <idosch@idosch•org>
To: Stephen Hemminger <stephen@networkplumber•org>
Cc: netdev@vger•kernel.org,
Stephen Hemminger <sthemmin@microsoft•com>,
idosch@nvidia•com
Subject: Re: [PATCH iproute2-next 06/11] nexthop: fix clang warning about timer check
Date: Tue, 11 Jan 2022 15:31:01 +0200 [thread overview]
Message-ID: <Yd2GlT3SMtiF3Oc2@shredder> (raw)
In-Reply-To: <20220108204650.36185-7-sthemmin@microsoft.com>
On Sat, Jan 08, 2022 at 12:46:45PM -0800, Stephen Hemminger wrote:
> diff --git a/ip/ipnexthop.c b/ip/ipnexthop.c
> index 83a5540e771c..2c65df294587 100644
> --- a/ip/ipnexthop.c
> +++ b/ip/ipnexthop.c
> @@ -31,6 +31,8 @@ enum {
> IPNH_FLUSH,
> };
>
> +#define TIMER_MAX (~(__u32)0 / 100)
> +
> #define RTM_NHA(h) ((struct rtattr *)(((char *)(h)) + \
> NLMSG_ALIGN(sizeof(struct nhmsg))))
>
> @@ -839,8 +841,8 @@ static void parse_nh_group_type_res(struct nlmsghdr *n, int maxlen, int *argcp,
> __u32 idle_timer;
>
> NEXT_ARG();
> - if (get_unsigned(&idle_timer, *argv, 0) ||
> - idle_timer >= ~0UL / 100)
> + if (get_u32(&idle_timer, *argv, 0) ||
> + idle_timer >= TIMER_MAX)
> invarg("invalid idle timer value", *argv);
>
> addattr32(n, maxlen, NHA_RES_GROUP_IDLE_TIMER,
> @@ -849,8 +851,8 @@ static void parse_nh_group_type_res(struct nlmsghdr *n, int maxlen, int *argcp,
> __u32 unbalanced_timer;
>
> NEXT_ARG();
> - if (get_unsigned(&unbalanced_timer, *argv, 0) ||
> - unbalanced_timer >= ~0UL / 100)
> + if (get_u32(&unbalanced_timer, *argv, 0) ||
> + unbalanced_timer >= TIMER_MAX)
> invarg("invalid unbalanced timer value", *argv);
I believe these were already addressed by:
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=5f8bb902e14f91161f9ed214d5fc1d813af8ed88
>
> addattr32(n, maxlen, NHA_RES_GROUP_UNBALANCED_TIMER,
> --
> 2.30.2
>
next prev parent reply other threads:[~2022-01-11 13:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-08 20:46 [PATCH iproute2-next 00/11] Clang warning fixes Stephen Hemminger
2022-01-08 20:46 ` [PATCH iproute2-next 01/11] tc: add format attribute to tc_print_rate Stephen Hemminger
2022-01-08 20:46 ` [PATCH iproute2-next 02/11] utils: add format attribute Stephen Hemminger
2022-01-08 20:46 ` [PATCH iproute2-next 03/11] netem: fix clang warnings Stephen Hemminger
2022-01-08 20:46 ` [PATCH iproute2-next 04/11] m_vlan: fix formatting of push ethernet src mac Stephen Hemminger
2022-01-08 21:29 ` Guillaume Nault
2022-01-08 20:46 ` [PATCH iproute2-next 05/11] flower: fix clang warnings Stephen Hemminger
2022-01-11 16:00 ` David Ahern
2022-01-08 20:46 ` [PATCH iproute2-next 06/11] nexthop: fix clang warning about timer check Stephen Hemminger
2022-01-11 13:31 ` Ido Schimmel [this message]
2022-01-11 16:01 ` David Ahern
2022-01-08 20:46 ` [PATCH iproute2-next 07/11] tc_util: fix clang warning in print_masked_type Stephen Hemminger
2022-01-08 20:46 ` [PATCH iproute2-next 08/11] ipl2tp: fix clang warning Stephen Hemminger
2022-01-08 20:46 ` [PATCH iproute2-next 09/11] can: " Stephen Hemminger
2022-01-08 20:46 ` [PATCH iproute2-next 10/11] tipc: fix clang warning about empty format string Stephen Hemminger
2022-01-08 20:46 ` [PATCH iproute2-next 11/11] tunnel: fix clang warning Stephen Hemminger
2022-01-10 17:20 ` [PATCH iproute2-next 00/11] Clang warning fixes Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Yd2GlT3SMtiF3Oc2@shredder \
--to=idosch@idosch$(echo .)org \
--cc=idosch@nvidia$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=stephen@networkplumber$(echo .)org \
--cc=sthemmin@microsoft$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox