[PATCH 1/1] bootflow: always initialize bootflow_iter_set_dev parameters

method_flags may be passed uninitialized to bootflow_iter_set_dev() if dev is not NULL.
Always initialize method_flags.
Addresses-Coverity-ID: 467057 Uninitialized scalar variable Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com --- boot/bootflow.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/boot/bootflow.c b/boot/bootflow.c index 68bf99329ab..f659a414c79 100644 --- a/boot/bootflow.c +++ b/boot/bootflow.c @@ -244,7 +244,7 @@ static int iter_incr(struct bootflow_iter *iter) if (iter->flags & BOOTFLOWIF_SINGLE_DEV) { ret = -ENOENT; } else { - int method_flags; + int method_flags = 0;
ret = 0; dev = iter->dev; @@ -263,7 +263,6 @@ static int iter_incr(struct bootflow_iter *iter) } else if (IS_ENABLED(CONFIG_BOOTSTD_FULL) && iter->flags & BOOTFLOWIF_SINGLE_MEDIA) { log_debug("next in single\n"); - method_flags = 0; do { /* * Move to the next bootdev child of this media @@ -305,7 +304,6 @@ static int iter_incr(struct bootflow_iter *iter) } } else { ret = bootdev_next_prio(iter, &dev); - method_flags = 0; } } log_debug("ret=%d, dev=%p %s\n", ret, dev,

On 11/Apr/2024 Heinrich Schuchardt wrote:
method_flags may be passed uninitialized to bootflow_iter_set_dev() if dev is not NULL.
Always initialize method_flags.
Addresses-Coverity-ID: 467057 Uninitialized scalar variable Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com
Reviewed-by: Nam Cao namcao@linutronix.de
boot/bootflow.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/boot/bootflow.c b/boot/bootflow.c index 68bf99329ab..f659a414c79 100644 --- a/boot/bootflow.c +++ b/boot/bootflow.c @@ -244,7 +244,7 @@ static int iter_incr(struct bootflow_iter *iter) if (iter->flags & BOOTFLOWIF_SINGLE_DEV) { ret = -ENOENT; } else {
int method_flags;
int method_flags = 0;
ret = 0; dev = iter->dev;
@@ -263,7 +263,6 @@ static int iter_incr(struct bootflow_iter *iter) } else if (IS_ENABLED(CONFIG_BOOTSTD_FULL) && iter->flags & BOOTFLOWIF_SINGLE_MEDIA) { log_debug("next in single\n");
method_flags = 0; do { /* * Move to the next bootdev child of this media
@@ -305,7 +304,6 @@ static int iter_incr(struct bootflow_iter *iter) } } else { ret = bootdev_next_prio(iter, &dev);
} log_debug("ret=%d, dev=%p %s\n", ret, dev,method_flags = 0; }

On 2024-04-11 Nam Cao wrote:
On 11/Apr/2024 Heinrich Schuchardt wrote:
method_flags may be passed uninitialized to bootflow_iter_set_dev() if dev is not NULL.
Always initialize method_flags.
Addresses-Coverity-ID: 467057 Uninitialized scalar variable Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com
Reviewed-by: Nam Cao namcao@linutronix.de
Wait hold up.
I was curious about the Addresses-Coverity-ID thing at looked it up. And I discovered that this patch was sent a few months a ago already [1].
What's the story here? Why is this patch resent? There was a test failure report the last time this patch was sent, has that been resolved yet?
Best regards, Nam
[1] https://lore.kernel.org/u-boot/20240118173802.GA2695740@bill-the-cat/T/
boot/bootflow.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/boot/bootflow.c b/boot/bootflow.c index 68bf99329ab..f659a414c79 100644 --- a/boot/bootflow.c +++ b/boot/bootflow.c @@ -244,7 +244,7 @@ static int iter_incr(struct bootflow_iter *iter) if (iter->flags & BOOTFLOWIF_SINGLE_DEV) { ret = -ENOENT; } else {
int method_flags;
int method_flags = 0;
ret = 0; dev = iter->dev;
@@ -263,7 +263,6 @@ static int iter_incr(struct bootflow_iter *iter) } else if (IS_ENABLED(CONFIG_BOOTSTD_FULL) && iter->flags & BOOTFLOWIF_SINGLE_MEDIA) { log_debug("next in single\n");
method_flags = 0; do { /* * Move to the next bootdev child of this media
@@ -305,7 +304,6 @@ static int iter_incr(struct bootflow_iter *iter) } } else { ret = bootdev_next_prio(iter, &dev);
} log_debug("ret=%d, dev=%p %s\n", ret, dev,method_flags = 0; }
participants (2)
-
Heinrich Schuchardt
-
Nam Cao