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";
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to