From: Maks Mishin Date: Sun, 7 Jul 2024 17:27:41 +0000 (+0300) Subject: f_flower: Remove always zero checks X-Git-Tag: v6.11.0~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b06341a252a815820c1bbacedec0c158dd80aac8;p=thirdparty%2Fiproute2.git f_flower: Remove always zero checks Expression 'ttl & ~(255 >> 0)' is always zero, because right operand has 8 trailing zero bits, which is greater or equal than the size of the left operand == 8 bits. Found by RASU JSC. Signed-off-by: Maks Mishin Reviewed-by: Guillaume Nault Reviewed-by: Simon Horman Signed-off-by: Stephen Hemminger --- diff --git a/tc/f_flower.c b/tc/f_flower.c index 08c1001a..244f0f7e 100644 --- a/tc/f_flower.c +++ b/tc/f_flower.c @@ -1523,7 +1523,7 @@ static int flower_parse_mpls_lse(int *argc_p, char ***argv_p, NEXT_ARG(); ret = get_u8(&ttl, *argv, 10); - if (ret < 0 || ttl & ~(MPLS_LS_TTL_MASK >> MPLS_LS_TTL_SHIFT)) { + if (ret < 0) { fprintf(stderr, "Illegal \"ttl\"\n"); return -1; } @@ -1936,7 +1936,7 @@ static int flower_parse_opt(const struct filter_util *qu, char *handle, } mpls_format_old = true; ret = get_u8(&ttl, *argv, 10); - if (ret < 0 || ttl & ~(MPLS_LS_TTL_MASK >> MPLS_LS_TTL_SHIFT)) { + if (ret < 0) { fprintf(stderr, "Illegal \"mpls_ttl\"\n"); return -1; }