summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2020-03-25 13:35:45 +0100
committerEdward O'Callaghan <quasisec@chromium.org>2020-03-26 03:15:08 +0000
commit6c8bd91e29719b9db2198d6ebf1ea33a26f9f5aa (patch)
tree67e0d0a690593c07487f12335a491ea4dbdad698
parent548c880760fc7d91411dd1364b6b01aacef7cab2 (diff)
downloadflashrom-6c8bd91e29719b9db2198d6ebf1ea33a26f9f5aa.tar.gz
flashrom-6c8bd91e29719b9db2198d6ebf1ea33a26f9f5aa.tar.bz2
flashrom-6c8bd91e29719b9db2198d6ebf1ea33a26f9f5aa.zip
Fix segfault when running `flashrom -L`
The raiden_debug programmer is of type USB. However, it does not set the field `devs.dev`, which will result in a segfault when trying to print the devices of the non-existing table. Fix that by replacing `devs.note` with `devs.dev` and adding an empty device table. Since Device IDs are not used to match programmers, nothing could be added to the table. TEST=Running `flashrom -L` no longer segfaults and returns normally. Change-Id: Ie4171a11384c34abb102d1aadf86aa1b8829fc04 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/39826 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
-rw-r--r--flashrom.c2
-rw-r--r--programmer.h1
-rw-r--r--raiden_debug_spi.c5
3 files changed, 7 insertions, 1 deletions
diff --git a/flashrom.c b/flashrom.c
index e541b68ff..081b705da 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -137,7 +137,7 @@ const struct programmer_entry programmer_table[] = {
{
.name = "raiden_debug",
.type = USB,
- .devs.note = "All programmer devices speaking the raiden protocol\n",
+ .devs.dev = devs_raiden,
.init = raiden_debug_spi_init,
.map_flash_region = fallback_map,
.unmap_flash_region = fallback_unmap,
diff --git a/programmer.h b/programmer.h
index 08500c6fc..9a41be107 100644
--- a/programmer.h
+++ b/programmer.h
@@ -407,6 +407,7 @@ extern const struct dev_entry gfx_nvidia[];
/* raiden_debug_spi.c */
#if CONFIG_RAIDEN == 1
int raiden_debug_spi_init(void);
+extern const struct dev_entry devs_raiden[];
#endif
/* drkaiser.c */
diff --git a/raiden_debug_spi.c b/raiden_debug_spi.c
index 691445545..173e35542 100644
--- a/raiden_debug_spi.c
+++ b/raiden_debug_spi.c
@@ -116,6 +116,11 @@
#include <string.h>
#include <unistd.h>
+/* FIXME: Add some programmer IDs here */
+const struct dev_entry devs_raiden[] = {
+ {0},
+};
+
#define GOOGLE_VID (0x18D1)
#define GOOGLE_RAIDEN_SPI_SUBCLASS (0x51)
#define GOOGLE_RAIDEN_SPI_PROTOCOL (0x01)