From 16b3e4bd2c2dbc14c42be85cca60ea647e60bd99 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Mon, 12 Dec 2016 18:38:01 +0100 Subject: [PATCH] util/cbfstool: require -i argument for cbfstool add-int We never specified what value add-int should write by default. Change-Id: I240be4842fc374690c4a718fc4d8f0a03d63003c Signed-off-by: Patrick Georgi Reviewed-on: https://review.coreboot.org/17796 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth Reviewed-by: Paul Menzel --- util/cbfstool/cbfstool.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c index c823dc8209..2d8483ba0b 100644 --- a/util/cbfstool/cbfstool.c +++ b/util/cbfstool/cbfstool.c @@ -70,6 +70,7 @@ static struct param { uint32_t cbfsoffset; uint32_t cbfsoffset_assigned; uint32_t arch; + bool u64val_assigned; bool fill_partial_upward; bool fill_partial_downward; bool show_immutable; @@ -716,6 +717,10 @@ static int cbfs_add_flat_binary(void) static int cbfs_add_integer(void) { + if (!param.u64val_assigned) { + ERROR("You need to specify a value to write.\n"); + return 1; + } return cbfs_add_integer_component(param.name, param.u64val, param.baseaddress, @@ -1452,6 +1457,7 @@ int main(int argc, char **argv) break; case 'i': param.u64val = strtoull(optarg, &suffix, 0); + param.u64val_assigned = 1; if (!*optarg || (suffix && *suffix)) { ERROR("Invalid int parameter '%s'.\n", optarg);