From: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
---|---|
To: | gorcom2012(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #18914: REDUNDANT_COMPARISON.ALWAYS_FALSE Redundant comparison '0' > 'nb' (0 > {4, 16}) is always false |
Date: | 2025-05-07 10:35:30 |
Message-ID: | E8B81620-8247-4AAE-BAD1-2D182FCC5B5A@yesql.se |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
> On 7 May 2025, at 10:48, PG Bug reporting form <noreply(at)postgresql(dot)org> wrote:
>
> The following bug has been logged on the website:
>
> Bug reference: 18914
> Logged by: Eugeny Goryachev
> Email address: gorcom2012(at)gmail(dot)com
> PostgreSQL version: 17.4
> Operating system: Ubuntu
> Description:
>
> REDUNDANT_COMPARISON.ALWAYS_FALSE Redundant comparison '0' > 'nb' (0 > {4,
> 16}) is always false at network.c:282.
> The function 'network_send()' in src/backend/utils/adt/network.c contains a
> redundant comparison:
> if (nb < 0)
> nb = 0;
> Since 'nb' is set via 'ip_addrsize(addr)', which returns either 4 or 16 (for
> IPv4 and IPv6 addresses respectively), this condition can never be true.
This was already addressed in commit f27eb0325b7b2c.
If you are going to run a static analyzer you should make sure to run it
against HEAD as small things like this one aren't backported.
--
Daniel Gustafsson
From | Date | Subject | |
---|---|---|---|
Next Message | PG Bug reporting form | 2025-05-07 13:14:43 | BUG #18915: pgdg-redhat-repo-42.0-51PGDG.noarch package not available in postgres repo |
Previous Message | David Rowley | 2025-05-07 10:34:16 | Re: BUG #18914: REDUNDANT_COMPARISON.ALWAYS_FALSE Redundant comparison '0' > 'nb' (0 > {4, 16}) is always false |