[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/6] firmware-qemu_fw_cfg: Improve a size determinat
From: |
SF Markus Elfring |
Subject: |
[Qemu-devel] [PATCH 2/6] firmware-qemu_fw_cfg: Improve a size determination in fw_cfg_register_file() |
Date: |
Sun, 18 Sep 2016 14:52:47 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
From: Markus Elfring <address@hidden>
Date: Sun, 18 Sep 2016 10:43:27 +0200
Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.
Signed-off-by: Markus Elfring <address@hidden>
---
drivers/firmware/qemu_fw_cfg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c
index e69653e..a229df6 100644
--- a/drivers/firmware/qemu_fw_cfg.c
+++ b/drivers/firmware/qemu_fw_cfg.c
@@ -458,7 +458,7 @@ static int fw_cfg_register_file(const struct fw_cfg_file *f)
return -ENOMEM;
/* set file entry information */
- memcpy(&entry->f, f, sizeof(struct fw_cfg_file));
+ memcpy(&entry->f, f, sizeof(*f));
/* register entry under "/sys/firmware/qemu_fw_cfg/by_key/" */
err = kobject_init_and_add(&entry->kobj, &fw_cfg_sysfs_entry_ktype,
--
2.10.0
- [Qemu-devel] [PATCH 0/6] firmware-qemu_fw_cfg: Fine-tuning for four function implementations, SF Markus Elfring, 2016/09/18
- [Qemu-devel] [PATCH 1/6] firmware-qemu_fw_cfg: Use kmalloc_array() in fw_cfg_register_dir_entries(), SF Markus Elfring, 2016/09/18
- [Qemu-devel] [PATCH 2/6] firmware-qemu_fw_cfg: Improve a size determination in fw_cfg_register_file(),
SF Markus Elfring <=
- [Qemu-devel] [PATCH 3/6] firmware-qemu_fw_cfg: Rename jump labels in fw_cfg_register_file(), SF Markus Elfring, 2016/09/18
- [Qemu-devel] [PATCH 4/6] firmware-qemu_fw_cfg: Improve a size determination in fw_cfg_build_symlink(), SF Markus Elfring, 2016/09/18
- [Qemu-devel] [PATCH 5/6] firmware-qemu_fw_cfg: Rename jump labels in fw_cfg_sysfs_probe(), SF Markus Elfring, 2016/09/18
- [Qemu-devel] [PATCH 6/6] firmware-qemu_fw_cfg: Move a variable assignment in fw_cfg_sysfs_probe(), SF Markus Elfring, 2016/09/18
- Re: [Qemu-devel] [PATCH 0/6] firmware-qemu_fw_cfg: Fine-tuning for four function implementations, Gabriel L. Somlo, 2016/09/20