Skip to content

Commit de6428a

Browse files
committed
Avoid another valgrind complaint about write() of uninitalized bytes.
Peter Geoghegan, per buildfarm member skink and Andres Freund Discussion: http://postgr.es/m/20180221053426.gp72lw67yfpzkw7a@alap3.anarazel.de
1 parent 9a5c4f5 commit de6428a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/backend/utils/sort/logtape.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,18 @@ LogicalTapeRewindForRead(LogicalTapeSet *lts, int tapenum, size_t buffer_size)
739739
*/
740740
if (lt->dirty)
741741
{
742+
/*
743+
* As long as we've filled the buffer at least once, its contents
744+
* are entirely defined from valgrind's point of view, even though
745+
* contents beyond the current end point may be stale. But it's
746+
* possible - at least in the case of a parallel sort - to sort
747+
* such small amount of data that we do not fill the buffer even
748+
* once. Tell valgrind that its contents are defined, so it
749+
* doesn't bleat.
750+
*/
751+
VALGRIND_MAKE_MEM_DEFINED(lt->buffer + lt->nbytes,
752+
lt->buffer_size - lt->nbytes);
753+
742754
TapeBlockSetNBytes(lt->buffer, lt->nbytes);
743755
ltsWriteBlock(lts, lt->curBlockNumber, (void *) lt->buffer);
744756
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy