From 96f209b946e400d1cca3b86331570843ee4c6243 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Fri, 8 Mar 2019 02:32:10 +0100 Subject: hw/nvram/fw_cfg: Remove the unnecessary boot_splash_filedata_size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 'boot_splash_filedata_size' was introduced as a global variable in 3d3b8303c6f. This variable is used as a 'size' argument to the fw_cfg_add_file(). This function has an interface contract with its 'data' argument, but there is no such contract for 'size' (this is not a referenced pointer). We can simply remove it. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Reviewed-by: Laszlo Ersek Message-Id: <20190308013222.12524-7-philmd@redhat.com> Signed-off-by: Laurent Vivier --- hw/nvram/fw_cfg.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'hw/nvram') diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 7fdf04a..13aab12 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -161,15 +161,14 @@ static void fw_cfg_bootsplash(FWCfgState *s) } g_free(boot_splash_filedata); boot_splash_filedata = (uint8_t *)file_data; - boot_splash_filedata_size = file_size; /* insert data */ if (file_type == JPG_FILE) { fw_cfg_add_file(s, "bootsplash.jpg", - boot_splash_filedata, boot_splash_filedata_size); + boot_splash_filedata, file_size); } else { fw_cfg_add_file(s, "bootsplash.bmp", - boot_splash_filedata, boot_splash_filedata_size); + boot_splash_filedata, file_size); } g_free(filename); } -- cgit v1.1 From 3b777a79c1cfa40f39f96220bc733eccd7392c9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Sat, 9 Mar 2019 19:19:20 +0100 Subject: hw/nvram/fw_cfg: Use the ldst API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The load/store API eases code review. Reviewed-by: Laszlo Ersek Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20190309181920.30553-3-philmd@redhat.com> Signed-off-by: Laurent Vivier --- hw/nvram/fw_cfg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'hw/nvram') diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 13aab12..5c3a46c 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -85,7 +85,7 @@ static char *read_splashfile(char *filename, gsize *file_sizep, } /* check magic ID */ - filehead = ((content[0] & 0xff) + (content[1] << 8)) & 0xffff; + filehead = lduw_le_p(content); if (filehead == 0xd8ff) { file_type = JPG_FILE; } else if (filehead == 0x4d42) { @@ -96,7 +96,7 @@ static char *read_splashfile(char *filename, gsize *file_sizep, /* check BMP bpp */ if (file_type == BMP_FILE) { - bmp_bpp = (content[28] + (content[29] << 8)) & 0xffff; + bmp_bpp = lduw_le_p(&content[28]); if (bmp_bpp != 24) { goto error; } -- cgit v1.1