Date: Thu, 23 Aug 2018 18:01:34 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338262 - head/stand/fdt Message-ID: <201808231801.w7NI1Y6l065616@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kevans Date: Thu Aug 23 18:01:34 2018 New Revision: 338262 URL: https://svnweb.freebsd.org/changeset/base/338262 Log: stand: fdt: Drop some write-only assignments/variables and leaked bits Generally straightforward enough; a copy of argv[1] was being made in command_fdt_internal, solely used for a comparison within the handler-search, then promptly leaked. Reported by: ports gcc and clang's static analyzer Modified: head/stand/fdt/fdt_loader_cmd.c Modified: head/stand/fdt/fdt_loader_cmd.c ============================================================================== --- head/stand/fdt/fdt_loader_cmd.c Thu Aug 23 17:50:41 2018 (r338261) +++ head/stand/fdt/fdt_loader_cmd.c Thu Aug 23 18:01:34 2018 (r338262) @@ -844,7 +844,6 @@ void fdt_fixup_stdout(const char *str) { char *ptr; - int serialno; int len, no, sero; const struct fdt_property *prop; char *tmp[10]; @@ -856,7 +855,6 @@ fdt_fixup_stdout(const char *str) if (ptr == str) return; - serialno = (int)strtol(ptr, NULL, 0); no = fdt_path_offset(fdtp, "/chosen"); if (no < 0) return; @@ -913,10 +911,8 @@ fdt_load_dtb_overlays(const char *extras) static int fdt_fixup(void) { - int chosen, len; + int chosen; - len = 0; - debugf("fdt_fixup()\n"); if (fdtp == NULL && fdt_setup_fdtp() != 0) @@ -973,7 +969,6 @@ command_fdt_internal(int argc, char *argv[]) { cmdf_t *cmdh; int flags; - char *cmd; int i, err; if (argc < 2) { @@ -984,11 +979,10 @@ command_fdt_internal(int argc, char *argv[]) /* * Validate fdt <command>. */ - cmd = strdup(argv[1]); i = 0; cmdh = NULL; while (!(commands[i].name == NULL)) { - if (strcmp(cmd, commands[i].name) == 0) { + if (strcmp(argv[1], commands[i].name) == 0) { /* found it */ cmdh = commands[i].handler; flags = commands[i].flags; @@ -1512,7 +1506,6 @@ fdt_modprop(int nodeoff, char *propname, void *value, sprintf(command_errbuf, "property does not exist!"); return (CMD_ERROR); } - len = strlen(value); rv = 0; buf = value;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808231801.w7NI1Y6l065616>