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
This commit is contained in:
kevans 2018-08-23 18:01:34 +00:00
parent 0b4e2ed1d7
commit f724405d78

View File

@ -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,9 +911,7 @@ fdt_load_dtb_overlays(const char *extras)
static int
fdt_fixup(void)
{
int chosen, len;
len = 0;
int chosen;
debugf("fdt_fixup()\n");
@ -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, char mode)
sprintf(command_errbuf, "property does not exist!");
return (CMD_ERROR);
}
len = strlen(value);
rv = 0;
buf = value;