Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1567743 > unrolled thread
| Started by | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| First post | 2017-01-26 23:00 +0100 |
| Last post | 2017-01-26 23:00 +0100 |
| Articles | 3 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH 0/3] Virtio: Fine-tuning for two function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-26 23:00 +0100
[PATCH 1/3] virtio_pci: Use kcalloc() in vp_request_msix_vectors() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-26 23:00 +0100
[PATCH 2/3] virtio_pci: Use kmalloc_array() in vp_request_msix_vectors() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-26 23:00 +0100
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-01-26 23:00 +0100 |
| Subject | [PATCH 0/3] Virtio: Fine-tuning for two function implementations |
| Message-ID | <t405A-458-23@gated-at.bofh.it> |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Thu, 26 Jan 2017 22:40:02 +0100 A few update suggestions were taken into account from static source code analysis. Markus Elfring (3): virtio_pci: Use kcalloc() in vp_request_msix_vectors() virtio_pci: Use kmalloc_array() in vp_request_msix_vectors() virtio_ring: Use kmalloc_array() in alloc_indirect() drivers/virtio/virtio_pci_common.c | 8 ++++---- drivers/virtio/virtio_ring.c | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) -- 2.11.0
[toc] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-01-26 23:00 +0100 |
| Subject | [PATCH 1/3] virtio_pci: Use kcalloc() in vp_request_msix_vectors() |
| Message-ID | <t40fh-48w-39@gated-at.bofh.it> |
| In reply to | #1567743 |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Thu, 26 Jan 2017 22:10:18 +0100 A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus reuse the corresponding function "kcalloc". This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- drivers/virtio/virtio_pci_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c index 186cbab327b8..559a2b706093 100644 --- a/drivers/virtio/virtio_pci_common.c +++ b/drivers/virtio/virtio_pci_common.c @@ -117,7 +117,7 @@ static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors, if (!vp_dev->msix_names) goto error; vp_dev->msix_affinity_masks - = kzalloc(nvectors * sizeof *vp_dev->msix_affinity_masks, + = kcalloc(nvectors, sizeof(*vp_dev->msix_affinity_masks), GFP_KERNEL); if (!vp_dev->msix_affinity_masks) goto error; -- 2.11.0
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-01-26 23:00 +0100 |
| Subject | [PATCH 2/3] virtio_pci: Use kmalloc_array() in vp_request_msix_vectors() |
| Message-ID | <t40fi-48w-45@gated-at.bofh.it> |
| In reply to | #1567743 |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Thu, 26 Jan 2017 22:20:30 +0100 A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus reuse the corresponding function "kmalloc_array". This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- drivers/virtio/virtio_pci_common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c index 559a2b706093..623a8cea1441 100644 --- a/drivers/virtio/virtio_pci_common.c +++ b/drivers/virtio/virtio_pci_common.c @@ -111,9 +111,9 @@ static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors, int err = -ENOMEM; vp_dev->msix_vectors = nvectors; - - vp_dev->msix_names = kmalloc(nvectors * sizeof *vp_dev->msix_names, - GFP_KERNEL); + vp_dev->msix_names = kmalloc_array(nvectors, + sizeof(*vp_dev->msix_names), + GFP_KERNEL); if (!vp_dev->msix_names) goto error; vp_dev->msix_affinity_masks -- 2.11.0
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web