pgsql: aio: Improve assertions related to io_method

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: aio: Improve assertions related to io_method
Date: 2025-11-05 01:04:35
Message-ID: E1vGRwx-0054gm-0i@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

aio: Improve assertions related to io_method

First, the assertions in assign_io_method() were the wrong way round. Second,
the lengthof() assertion checked the length of io_method_options, which is the
wrong array to check and is always longer than pgaio_method_ops_table.

While add it, add a static assert to ensure pgaio_method_ops_table and
io_method_options stay in sync.

Per coverity and Tom Lane.

Reported-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Backpatch-through: 18

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/dae00f333bdd98d094275080dba248cc80d4ca04

Modified Files
--------------
src/backend/storage/aio/aio.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2025-11-05 01:43:12 pgsql: Add assertions checking for the startup process in WAL replay ro
Previous Message Jeff Davis 2025-11-05 00:49:47 pgsql: Special case C_COLLATION_OID in pg_newlocale_from_collation().