summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Larysch <fl@n621.de>2020-08-03 19:23:23 +0200
committerFlorian Larysch <fl@n621.de>2020-08-03 19:26:43 +0200
commit924aaae0883ef8962e0af1a4a57b288519330c9b (patch)
tree7fded574955b234bf61d45e399706add0369b663
parent3602bd64b84c20186bb72ce209b8b0023b0c50f9 (diff)
downloadgenimage-924aaae0883ef8962e0af1a4a57b288519330c9b.tar.gz
genimage-924aaae0883ef8962e0af1a4a57b288519330c9b.tar.xz
genimage: initialize return value
The "ret" variable in image_setup is not initialized when an image does not contain any partitions and the image handler does not provide a setup function. This can cause image_setup to error out erroneously. These conditions are fulfilled by the cpio test case, but this bug only becomes visible when the stack content aligns accordingly. Initialize ret to 0, as image_setup can be considered successful in this case. Signed-off-by: Florian Larysch <fl@n621.de>
-rw-r--r--genimage.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/genimage.c b/genimage.c
index 26c000c..530a12d 100644
--- a/genimage.c
+++ b/genimage.c
@@ -147,7 +147,7 @@ struct image *image_get(const char *filename)
*/
static int image_setup(struct image *image)
{
- int ret;
+ int ret = 0;
struct partition *part;
if (image->done < 0)