MCPcopy Create free account
hub / github.com/coreboot/coreboot / malloc_fo_sub

Function malloc_fo_sub

util/intelvbttool/intelvbttool.c:350–365  ·  view source on GitHub ↗

* Creates a new subregion copy of fileobject. * Returns NULL if offset is greater than fileobject size. * Returns NULL on error. */

Source from the content-addressed store, hash-verified

348 * Returns NULL on error.
349 */
350static struct fileobject *malloc_fo_sub(const struct fileobject *old,
351 const size_t off)
352{
353 struct fileobject *fo;
354
355 if (!old || off > old->size)
356 return NULL;
357
358 fo = malloc_fo(old->size - off);
359 if (!fo)
360 return NULL;
361
362 memcpy(fo->data, old->data + off, fo->size);
363
364 return fo;
365}
366
367/* file helpers */
368

Callers 2

parse_vbtFunction · 0.85
parse_vbiosFunction · 0.85

Calls 2

malloc_foFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected