Fix integer underflow in shared memory debugging
dsa_dump would print a large negative number instead of zero for segment bin 0. Fix by explicitly checking for underflow and add special case for bin 0. Backpatch to all supported versions. Author: Ian Ilyasov <ianilyasov@outlook.com> Reviewed-by: Robert Haas <robertmhaas@gmail.com> Discussion: https://postgr.es/m/GV1P251MB1004E0D09D117D3CECF9256ECD502@GV1P251MB1004.EURP251.PROD.OUTLOOK.COM Backpatch-through: v12
This commit is contained in:
parent
43cca9de9a
commit
d5c3d6ca01
@ -1093,6 +1093,10 @@ dsa_dump(dsa_area *area)
|
|||||||
{
|
{
|
||||||
dsa_segment_index segment_index;
|
dsa_segment_index segment_index;
|
||||||
|
|
||||||
|
if (i == 0)
|
||||||
|
fprintf(stderr,
|
||||||
|
" segment bin %zu (no contiguous free pages):\n", i);
|
||||||
|
else
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
" segment bin %zu (at least %d contiguous pages free):\n",
|
" segment bin %zu (at least %d contiguous pages free):\n",
|
||||||
i, 1 << (i - 1));
|
i, 1 << (i - 1));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user