]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
tools: open FIT image read-only
authorAhelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Thu, 21 Mar 2024 18:31:54 +0000 (19:31 +0100)
committerTom Rini <trini@konsulko.com>
Wed, 10 Apr 2024 15:34:53 +0000 (09:34 -0600)
Open for reading as O_RDONLY instead of O_RDWR:
the only usage of the fd is for the single read() below;
this prevented
mkimage -f auto -A arm64 \
-T kernel -C lz4 -d Image-6.6.15.lz4 \
-b mt8173-elm-hana-6.6.15.dtb outf
when the inputs were unwritable.

Link: https://bugs.debian.org/1063097
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Reviewed-by: Dragan Simic <dsimic@manjaro.org>
tools/fit_image.c

index beef1fa86e28a3e4265a253bf0b9b777633cd682..0fccfbb4ebda47f6a43f21b6a4e4064797597d13 100644 (file)
@@ -137,7 +137,7 @@ static int fdt_property_file(struct image_tool_params *params,
        int ret;
        int fd;
 
-       fd = open(fname, O_RDWR | O_BINARY);
+       fd = open(fname, O_RDONLY | O_BINARY);
        if (fd < 0) {
                fprintf(stderr, "%s: Can't open %s: %s\n",
                        params->cmdname, fname, strerror(errno));