[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180214141850.4017-7-marcandre.lureau@redhat.com>
Date: Wed, 14 Feb 2018 15:18:47 +0100
From: Marc-André Lureau <marcandre.lureau@...hat.com>
To: linux-kernel@...r.kernel.org
Cc: bhe@...hat.com, slp@...hat.com, mst@...hat.com, somlo@....edu,
xiaolong.ye@...el.com,
Marc-André Lureau <marcandre.lureau@...hat.com>
Subject: [PATCH v14 6/9] fw_cfg: fix sparse warnings around FW_CFG_FILE_DIR read
Use struct fw_cfg_files to read the directory size, fixing the sparse
warnings:
drivers/firmware/qemu_fw_cfg.c:485:17: warning: cast to restricted __be32
Signed-off-by: Marc-André Lureau <marcandre.lureau@...hat.com>
---
drivers/firmware/qemu_fw_cfg.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c
index 4c4813409447..c4c726841ba7 100644
--- a/drivers/firmware/qemu_fw_cfg.c
+++ b/drivers/firmware/qemu_fw_cfg.c
@@ -478,18 +478,19 @@ static int fw_cfg_register_dir_entries(void)
{
int ret = 0;
u32 count, i;
+ struct fw_cfg_files files;
struct fw_cfg_file *dir;
size_t dir_size;
- fw_cfg_read_blob(FW_CFG_FILE_DIR, &count, 0, sizeof(count));
- count = be32_to_cpu(count);
+ fw_cfg_read_blob(FW_CFG_FILE_DIR, &files.count, 0, sizeof(files.count));
+ count = be32_to_cpu(files.count);
dir_size = count * sizeof(struct fw_cfg_file);
dir = kmalloc(dir_size, GFP_KERNEL);
if (!dir)
return -ENOMEM;
- fw_cfg_read_blob(FW_CFG_FILE_DIR, dir, sizeof(count), dir_size);
+ fw_cfg_read_blob(FW_CFG_FILE_DIR, dir, sizeof(files.count), dir_size);
for (i = 0; i < count; i++) {
ret = fw_cfg_register_file(&dir[i]);
--
2.16.1.73.g5832b7e9f2
Powered by blists - more mailing lists