diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2018-02-28 10:06:08 -0500 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2018-03-19 21:17:39 -0400 |
commit | 3d47a34ba6761a64b78a8b89f6bbe93b4e8455f1 (patch) | |
tree | dca063229a600f43262cbeabf8bf75a47ee5bf39 /drivers/firmware/qemu_fw_cfg.c | |
parent | f295c8dba71841f007e2154143109d1517670a08 (diff) |
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@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/firmware/qemu_fw_cfg.c')
-rw-r--r-- | drivers/firmware/qemu_fw_cfg.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c index 0eb155fdfb35..00ad9b862414 100644 --- a/drivers/firmware/qemu_fw_cfg.c +++ b/drivers/firmware/qemu_fw_cfg.c | |||
@@ -496,19 +496,20 @@ err_register: | |||
496 | static int fw_cfg_register_dir_entries(void) | 496 | static int fw_cfg_register_dir_entries(void) |
497 | { | 497 | { |
498 | int ret = 0; | 498 | int ret = 0; |
499 | __be32 files_count; | ||
499 | u32 count, i; | 500 | u32 count, i; |
500 | struct fw_cfg_file *dir; | 501 | struct fw_cfg_file *dir; |
501 | size_t dir_size; | 502 | size_t dir_size; |
502 | 503 | ||
503 | fw_cfg_read_blob(FW_CFG_FILE_DIR, &count, 0, sizeof(count)); | 504 | fw_cfg_read_blob(FW_CFG_FILE_DIR, &files_count, 0, sizeof(files_count)); |
504 | count = be32_to_cpu(count); | 505 | count = be32_to_cpu(files_count); |
505 | dir_size = count * sizeof(struct fw_cfg_file); | 506 | dir_size = count * sizeof(struct fw_cfg_file); |
506 | 507 | ||
507 | dir = kmalloc(dir_size, GFP_KERNEL); | 508 | dir = kmalloc(dir_size, GFP_KERNEL); |
508 | if (!dir) | 509 | if (!dir) |
509 | return -ENOMEM; | 510 | return -ENOMEM; |
510 | 511 | ||
511 | fw_cfg_read_blob(FW_CFG_FILE_DIR, dir, sizeof(count), dir_size); | 512 | fw_cfg_read_blob(FW_CFG_FILE_DIR, dir, sizeof(files_count), dir_size); |
512 | 513 | ||
513 | for (i = 0; i < count; i++) { | 514 | for (i = 0; i < count; i++) { |
514 | ret = fw_cfg_register_file(&dir[i]); | 515 | ret = fw_cfg_register_file(&dir[i]); |