diff --git a/contrib/pg_walinspect/pg_walinspect.c b/contrib/pg_walinspect/pg_walinspect.c
index e4dbf15e05..e6f18e1c64 100644
--- a/contrib/pg_walinspect/pg_walinspect.c
+++ b/contrib/pg_walinspect/pg_walinspect.c
@@ -401,7 +401,7 @@ GetWALBlockInfo(FunctionCallInfo fcinfo, XLogReaderState *record,
 							 values, nulls);
 	}
 
-#undef PG_GET_WAL_FPI_BLOCK_COLS
+#undef PG_GET_WAL_BLOCK_INFO_COLS
 }
 
 /*
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d9bbeafd82..ca1bb6d00d 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -17063,7 +17063,8 @@ RangeVarCallbackForTruncate(const RangeVar *relation,
 
 /*
  * Callback to RangeVarGetRelidExtended(), similar to
- * RangeVarCallbackOwnsTable() but without checks on the type of the relation.
+ * RangeVarCallbackMaintainsTable() but without checks on the type of the
+ * relation.
  */
 void
 RangeVarCallbackOwnsRelation(const RangeVar *relation,
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
index f1316eb4ce..e982a8dd7f 100644
--- a/src/backend/storage/smgr/md.c
+++ b/src/backend/storage/smgr/md.c
@@ -597,7 +597,7 @@ mdzeroextend(SMgrRelation reln, ForkNumber forknum,
 			/*
 			 * Even if we don't want to use fallocate, we can still extend a
 			 * bit more efficiently than writing each 8kB block individually.
-			 * pg_pwrite_zeroes() (via FileZero()) uses
+			 * pg_pwrite_zeros() (via FileZero()) uses
 			 * pg_pwritev_with_retry() to avoid multiple writes or needing a
 			 * zeroed buffer for the whole length of the extension.
 			 */
diff --git a/src/backend/utils/adt/array_userfuncs.c b/src/backend/utils/adt/array_userfuncs.c
index 33e2b98307..171fdc67bb 100644
--- a/src/backend/utils/adt/array_userfuncs.c
+++ b/src/backend/utils/adt/array_userfuncs.c
@@ -1043,7 +1043,7 @@ array_agg_array_combine(PG_FUNCTION_ARGS)
 		state1->nitems += state2->nitems;
 
 		state1->dims[0] += state2->dims[0];
-		/* remaing dims already match, per test above */
+		/* remaining dims already match, per test above */
 
 		Assert(state1->array_type == state2->array_type);
 		Assert(state1->element_type == state2->element_type);
diff --git a/src/backend/utils/resowner/resowner.c b/src/backend/utils/resowner/resowner.c
index 4357dd0870..7dec652106 100644
--- a/src/backend/utils/resowner/resowner.c
+++ b/src/backend/utils/resowner/resowner.c
@@ -521,7 +521,7 @@ ResourceOwnerReleaseInternal(ResourceOwner owner,
 	{
 		/*
 		 * Abort failed buffer IO. AbortBufferIO()->TerminateBufferIO() calls
-		 * ResourceOwnerForgetBufferIOs(), so we just have to iterate till
+		 * ResourceOwnerForgetBufferIO(), so we just have to iterate till
 		 * there are none.
 		 *
 		 * Needs to be before we release buffer pins.
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index cd421c5944..7b7acc8044 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -1923,7 +1923,7 @@ dumpTimestamp(const char *msg)
 }
 
 /*
- * Helper function for rolenamehash hash table.
+ * Helper function for rolename_hash hash table.
  */
 static uint32
 hash_string_pointer(char *s)
diff --git a/src/include/access/rmgrdesc_utils.h b/src/include/access/rmgrdesc_utils.h
index e09b112674..bd414699f2 100644
--- a/src/include/access/rmgrdesc_utils.h
+++ b/src/include/access/rmgrdesc_utils.h
@@ -63,4 +63,4 @@ extern void offset_elem_desc(StringInfo buf, void *offset, void *data);
 extern void redirect_elem_desc(StringInfo buf, void *offset, void *data);
 extern void oid_elem_desc(StringInfo buf, void *relid, void *data);
 
-#endif							/* RMGRDESC_UTILS_H */
+#endif							/* RMGRDESC_UTILS_H_ */
diff --git a/src/include/port/pg_iovec.h b/src/include/port/pg_iovec.h
index 2a0e2c0123..689799c425 100644
--- a/src/include/port/pg_iovec.h
+++ b/src/include/port/pg_iovec.h
@@ -36,7 +36,7 @@ struct iovec
 #define PG_IOV_MAX Min(IOV_MAX, 32)
 
 /*
- * Note that pg_preadv and pg_writev have a pg_ prefix as a warning that the
+ * Note that pg_preadv and pg_pwritev have a pg_ prefix as a warning that the
  * Windows implementations have the side-effect of changing the file position.
  */
 
diff --git a/src/interfaces/libpq/fe-secure-gssapi.c b/src/interfaces/libpq/fe-secure-gssapi.c
index bf87ae3fd1..95ded9eeaa 100644
--- a/src/interfaces/libpq/fe-secure-gssapi.c
+++ b/src/interfaces/libpq/fe-secure-gssapi.c
@@ -624,7 +624,7 @@ pqsecure_open_gss(PGconn *conn)
 
 	if (conn->gssdeleg && pg_strcasecmp(conn->gssdeleg, "enable") == 0)
 	{
-		/* Acquire credentials if possbile */
+		/* Acquire credentials if possible */
 		if (conn->gcred == GSS_C_NO_CREDENTIAL)
 			(void) pg_GSS_have_cred_cache(&conn->gcred);
 
diff --git a/src/port/dirmod.c b/src/port/dirmod.c
index bf7f06885e..6557cf8785 100644
--- a/src/port/dirmod.c
+++ b/src/port/dirmod.c
@@ -400,7 +400,7 @@ pgreadlink(const char *path, char *buf, size_t size)
 	 * If the path starts with "\??\" followed by a "drive absolute" path
 	 * (known to Windows APIs as RtlPathTypeDriveAbsolute), then strip that
 	 * prefix.  This undoes some of the transformation performed by
-	 * pqsymlink(), to get back to a format that users are used to seeing.  We
+	 * pgsymlink(), to get back to a format that users are used to seeing.  We
 	 * don't know how to transform other path types that might be encountered
 	 * outside PGDATA, so we just return them directly.
 	 */
