projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
kwbimage: Fix out of bounds access
[oweals/u-boot.git]
/
cmd
/
fpga.c
diff --git
a/cmd/fpga.c
b/cmd/fpga.c
index 7f99aabf8a5c69454a19fced5a71c596b043dddc..ac6f504140613b6753b42e66f9fd5f86ba971cc2 100644
(file)
--- a/
cmd/fpga.c
+++ b/
cmd/fpga.c
@@
-18,15
+18,17
@@
static int fpga_get_op(char *opstr);
/* Local defines */
static int fpga_get_op(char *opstr);
/* Local defines */
-#define FPGA_NONE -1
-#define FPGA_INFO 0
-#define FPGA_LOAD 1
-#define FPGA_LOADB 2
-#define FPGA_DUMP 3
-#define FPGA_LOADMK 4
-#define FPGA_LOADP 5
-#define FPGA_LOADBP 6
-#define FPGA_LOADFS 7
+enum {
+ FPGA_NONE = -1,
+ FPGA_INFO,
+ FPGA_LOAD,
+ FPGA_LOADB,
+ FPGA_DUMP,
+ FPGA_LOADMK,
+ FPGA_LOADP,
+ FPGA_LOADBP,
+ FPGA_LOADFS,
+};
/* ------------------------------------------------------------------------- */
/* command form:
/* ------------------------------------------------------------------------- */
/* command form:
@@
-41,8
+43,8
@@
int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
int op, dev = FPGA_INVALID_DEVICE;
size_t data_size = 0;
void *fpga_data = NULL;
int op, dev = FPGA_INVALID_DEVICE;
size_t data_size = 0;
void *fpga_data = NULL;
- char *devstr =
getenv
("fpga");
- char *datastr =
getenv
("fpgadata");
+ char *devstr =
env_get
("fpga");
+ char *datastr =
env_get
("fpgadata");
int rc = FPGA_FAIL;
int wrong_parms = 0;
#if defined(CONFIG_FIT)
int rc = FPGA_FAIL;
int wrong_parms = 0;
#if defined(CONFIG_FIT)
@@
-86,7
+88,7
@@
int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
debug("* fpga: cmdline image address = 0x%08lx\n",
(ulong)fpga_data);
}
debug("* fpga: cmdline image address = 0x%08lx\n",
(ulong)fpga_data);
}
- debug("%s: fpga_data = 0x%
x\n", __func__, (uint
)fpga_data);
+ debug("%s: fpga_data = 0x%
lx\n", __func__, (ulong
)fpga_data);
case 3: /* fpga <op> <dev | data addr> */
dev = (int)simple_strtoul(argv[2], NULL, 16);
case 3: /* fpga <op> <dev | data addr> */
dev = (int)simple_strtoul(argv[2], NULL, 16);
@@
-107,13
+109,13
@@
int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
} else
#endif
{
} else
#endif
{
- fpga_data = (void *)dev;
+ fpga_data = (void *)
(uintptr_t)
dev;
debug("* fpga: cmdline image addr = 0x%08lx\n",
(ulong)fpga_data);
}
debug("* fpga: cmdline image addr = 0x%08lx\n",
(ulong)fpga_data);
}
- debug("%s: fpga_data = 0x%x\n",
- __func__, (u
int
)fpga_data);
+ debug("%s: fpga_data = 0x%
l
x\n",
+ __func__, (u
long
)fpga_data);
dev = FPGA_INVALID_DEVICE; /* reset device num */
}
dev = FPGA_INVALID_DEVICE; /* reset device num */
}