cbfstool: drop size argument to cbfs_add_entry_at

It's sole use was comparing it to the header's "len" field.

Change-Id: Ic3657a709dee0d2b9288373757345a1a56124f37
Signed-off-by: Patrick Georgi <patrick@georgi-clan.de>
Reviewed-on: http://review.coreboot.org/11324
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Patrick Georgi 2015-08-25 13:16:04 +02:00 committed by Patrick Georgi
parent ae7efb9257
commit 19c80b2391
1 changed files with 2 additions and 4 deletions

View File

@ -455,7 +455,6 @@ int cbfs_image_delete(struct cbfs_image *image)
/* Tries to add an entry with its data (CBFS_SUBHEADER) at given offset. */ /* Tries to add an entry with its data (CBFS_SUBHEADER) at given offset. */
static int cbfs_add_entry_at(struct cbfs_image *image, static int cbfs_add_entry_at(struct cbfs_image *image,
struct cbfs_file *entry, struct cbfs_file *entry,
uint32_t size,
const void *data, const void *data,
uint32_t content_offset, uint32_t content_offset,
const void *header_data, const void *header_data,
@ -502,13 +501,12 @@ static int cbfs_add_entry_at(struct cbfs_image *image,
} }
// Ready to fill data into entry. // Ready to fill data into entry.
assert(ntohl(entry->len) == size);
DEBUG("content_offset: 0x%x, entry location: %x\n", DEBUG("content_offset: 0x%x, entry location: %x\n",
content_offset, (int)((char*)CBFS_SUBHEADER(entry) - content_offset, (int)((char*)CBFS_SUBHEADER(entry) -
image->buffer.data)); image->buffer.data));
assert((char*)CBFS_SUBHEADER(entry) - image->buffer.data == assert((char*)CBFS_SUBHEADER(entry) - image->buffer.data ==
(ptrdiff_t)content_offset); (ptrdiff_t)content_offset);
memcpy(CBFS_SUBHEADER(entry), data, size); memcpy(CBFS_SUBHEADER(entry), data, ntohl(entry->len));
if (verbose > 1) cbfs_print_entry_info(image, entry, stderr); if (verbose > 1) cbfs_print_entry_info(image, entry, stderr);
// Process buffer AFTER entry. // Process buffer AFTER entry.
@ -612,7 +610,7 @@ int cbfs_add_entry(struct cbfs_image *image, struct buffer *buffer,
struct cbfs_file *header = struct cbfs_file *header =
cbfs_create_file_header(type, buffer->size, name); cbfs_create_file_header(type, buffer->size, name);
if (cbfs_add_entry_at(image, entry, buffer->size, if (cbfs_add_entry_at(image, entry,
buffer->data, content_offset, header, buffer->data, content_offset, header,
header_size) == 0) { header_size) == 0) {
free(header); free(header);