[PATCH 1/9] qemu-edid: use qemu_edid_size()

Gerd Hoffmann posted 9 patches 4 years, 9 months ago
Maintainers: Gerd Hoffmann <kraxel@redhat.com>
There is a newer version of this series
[PATCH 1/9] qemu-edid: use qemu_edid_size()
Posted by Gerd Hoffmann 4 years, 9 months ago
So we only write out that part of the edid blob
which has been filled with data.
Also use a larger buffer for the blob.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 qemu-edid.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/qemu-edid.c b/qemu-edid.c
index 1cd6a9517238..c3a9fba10dc4 100644
--- a/qemu-edid.c
+++ b/qemu-edid.c
@@ -41,7 +41,8 @@ static void usage(FILE *out)
 int main(int argc, char *argv[])
 {
     FILE *outfile = NULL;
-    uint8_t blob[256];
+    uint8_t blob[512];
+    size_t size;
     uint32_t dpi = 100;
     int rc;
 
@@ -119,7 +120,8 @@ int main(int argc, char *argv[])
 
     memset(blob, 0, sizeof(blob));
     qemu_edid_generate(blob, sizeof(blob), &info);
-    fwrite(blob, sizeof(blob), 1, outfile);
+    size = qemu_edid_size(blob);
+    fwrite(blob, size, 1, outfile);
     fflush(outfile);
 
     exit(0);
-- 
2.30.2


Re: [PATCH 1/9] qemu-edid: use qemu_edid_size()
Posted by Philippe Mathieu-Daudé 4 years, 9 months ago
On 3/16/21 3:38 PM, Gerd Hoffmann wrote:
> So we only write out that part of the edid blob
> which has been filled with data.
> Also use a larger buffer for the blob.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  qemu-edid.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>