Use the correct sizeof() in BufFileLoadBuffer
authorTomas Vondra <[email protected]>
Fri, 24 Jan 2025 23:36:48 +0000 (00:36 +0100)
committerTomas Vondra <[email protected]>
Sat, 25 Jan 2025 01:16:06 +0000 (02:16 +0100)
commitfb60050f42019b1dc5781fa0f43ca0fa7f0de9c7
tree9d42c12843a8c13615c196e351843ea27528de10
parent63a4b9f767866f4cbe7416c7eff7e35206d871b5
Use the correct sizeof() in BufFileLoadBuffer

The sizeof() call should reference buffer.data, because that's the
buffer we're reading data into, not the whole PGAlignedBuffer union.
This was introduced by 44cac93464, which replaced the simple buffer
with a PGAlignedBuffer field.

It's benign, because the buffer is the largest field of the union, so
the sizes are the same. But it's easy to trip over this in a patch, so
fix and backpatch. Commit 44cac93464 went into 12, but that's EOL.

Backpatch-through: 13
Discussion: https://postgr.es/m/928bdab1-6567-449f-98c4-339cd2203b87@vondra.me
src/backend/storage/file/buffile.c