Re: Fix condition in shm_toc and remove unused function shm_toc_freespace. - Mailing list pgsql-hackers

From Zhang Mingli
Subject Re: Fix condition in shm_toc and remove unused function shm_toc_freespace.
Date
Msg-id 70ce9710-e9ed-4a25-a327-88de830b8cf6@Spark
Whole thread Raw
In response to Fix condition in shm_toc and remove unused function shm_toc_freespace.  (Zhang Mingli <zmlpostgres@gmail.com>)
Responses Re: Fix condition in shm_toc and remove unused function shm_toc_freespace.
List pgsql-hackers
Hi,

On Jan 12, 2023, 14:34 +0800, Zhang Mingli <zmlpostgres@gmail.com>, wrote:
Hi, hackers

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.

Regards,
Zhang Mingli

pgsql-hackers by date:

Previous
From: John Naylor
Date:
Subject: Re: Small miscellaneus fixes (Part II)
Next
From: Pavel Stehule
Date:
Subject: Re: On login trigger: take three