svn commit: r261819 - head/sys/boot/fdt
Ian Lepore
ian at FreeBSD.org
Thu Feb 13 04:13:50 UTC 2014
Author: ian
Date: Thu Feb 13 04:13:50 2014
New Revision: 261819
URL: http://svnweb.freebsd.org/changeset/base/261819
Log:
Validate the header of a new dtb before using it. Remove the comment
that says that should be done.
Modified:
head/sys/boot/fdt/fdt_loader_cmd.c
Modified: head/sys/boot/fdt/fdt_loader_cmd.c
==============================================================================
--- head/sys/boot/fdt/fdt_loader_cmd.c Thu Feb 13 04:10:27 2014 (r261818)
+++ head/sys/boot/fdt/fdt_loader_cmd.c Thu Feb 13 04:13:50 2014 (r261819)
@@ -227,10 +227,15 @@ fdt_load_dtb(vm_offset_t va)
static int
fdt_load_dtb_addr(struct fdt_header *header)
{
+ int err;
- // TODO: Verify that there really is an FDT at
- // the specified location.
fdtp_size = fdt_totalsize(header);
+ err = fdt_check_header(&header);
+ if (err < 0) {
+ sprintf(command_errbuf, "error validating blob: %s",
+ fdt_strerror(err));
+ return (err);
+ }
free(fdtp);
if ((fdtp = malloc(fdtp_size)) == NULL) {
command_errmsg = "can't allocate memory for device tree copy";
More information about the svn-src-head
mailing list