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

Function check_with_maps

ccan/ccan/ptr_valid/ptr_valid.c:145–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

ptr_valid_batchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected