MCPcopy Create free account
hub / github.com/ElementsProject/lightning / check_with_maps

Function check_with_maps

ccan/ccan/ptr_valid/ptr_valid.c:140–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138#endif
139
140static bool check_with_maps(struct ptr_valid_batch *batch,
141 const char *p, size_t size, bool is_write)
142{
143 unsigned int i;
144
145 for (i = 0; i < batch->num_maps; i++) {
146 if (p >= batch->maps[i].start && p < batch->maps[i].end) {
147 /* Overlap into other maps? Recurse with remainder. */
148 if (p + size > batch->maps[i].end) {
149 size_t len = p + size - batch->maps[i].end;
150 if (!check_with_maps(batch, batch->maps[i].end,
151 len, is_write))
152 return false;
153 }
154 return !is_write || batch->maps[i].is_write;
155 }
156 }
157 return false;
158}
159
160static void finish_child(struct ptr_valid_batch *batch)
161{

Callers 1

ptr_valid_batchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected