Date: Thu, 13 Feb 2014 04:13:50 +0000 (UTC) From: Ian Lepore <ian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r261819 - head/sys/boot/fdt Message-ID: <201402130413.s1D4DoJb058530@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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";
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201402130413.s1D4DoJb058530>