public inbox for [email protected]
help / color / mirror / Atom feedFrom: Richard Guo <[email protected]>
To: Zhang Mingli <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Fix condition in shm_toc and remove unused function shm_toc_freespace.
Date: Thu, 12 Jan 2023 16:54:40 +0800
Message-ID: <CAMbWs49f3M1ZrFuiQE5AoWqTERUUXdoeKFg6Di6BuYWFSZ24pA@mail.gmail.com> (raw)
In-Reply-To: <70ce9710-e9ed-4a25-a327-88de830b8cf6@Spark>
References: <f937934f-5b6c-402c-a9ab-605bd07dcba9@Spark>
<1c7954e4-1705-4855-a99d-c77bf426c3e7@Spark>
<70ce9710-e9ed-4a25-a327-88de830b8cf6@Spark>
On Thu, Jan 12, 2023 at 2:50 PM Zhang Mingli <[email protected]> wrote:
> On Jan 12, 2023, 14:34 +0800, Zhang Mingli <[email protected]>, wrote:
>
> Some conditions in shm_toc_insert and shm_toc_allocate are bogus, like:
> if (toc_bytes + nbytes > total_bytes || toc_bytes + nbytes < toc_bytes)
> Remove the condition `toc_bytes + nbytes < toc_bytes` and take a
> sizeof(shm_entry) into account in shm_toc_allocate though
> shm_toc_allocate does that too.
>
> shm_toc_insert does that too, and we can report error earlier.
>
I don't think we should consider sizeof(shm_toc_entry) in the 'if'
condition in shm_toc_allocate, as this function is not in charge of
allocating a new TOC entry. That's what shm_toc_insert does.
Other parts of this patch look good to me.
Thanks
Richard
view thread (5+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Fix condition in shm_toc and remove unused function shm_toc_freespace.
In-Reply-To: <CAMbWs49f3M1ZrFuiQE5AoWqTERUUXdoeKFg6Di6BuYWFSZ24pA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox