From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753924AbdAZV5O (ORCPT ); Thu, 26 Jan 2017 16:57:14 -0500 Received: from mout.web.de ([212.227.15.4]:53751 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753824AbdAZV5M (ORCPT ); Thu, 26 Jan 2017 16:57:12 -0500 Subject: [PATCH 1/3] virtio_pci: Use kcalloc() in vp_request_msix_vectors() To: virtualization@lists.linux-foundation.org, Jason Wang , "Michael S. Tsirkin" References: <61829748-a13d-42e4-8f6c-103ee5ca2c88@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: <57a18132-3b9d-0e5b-5372-efe525f83100@users.sourceforge.net> Date: Thu, 26 Jan 2017 22:46:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <61829748-a13d-42e4-8f6c-103ee5ca2c88@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:saO/9ccRTm2m2is7lR+bPxHRMA4LDSKZM8T1Sw0KeDN00AcGhrS 3RD9lA0j8dY95eDTOh9OfC/YG0a4zw3a0KLgRhbiselohth7tZn/axFrMhbYWGnYGtrkLSf QwgIH67iuM2B7VdGOVt9LkTI+11ZnV6v1PNk5NWO7UBYinxPh2/rgJvEZRzHObjNXb/erQH zbEMagJ/m9ln8nKR3ctyQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:PNAgxdJHQwc=:Fu0XJAXvkNCrfLbon7aIlp XZ3dCB+q3X928RfcbWEWCX1vXiHcupLjyzYbfmGRb5JPN8a1u82CY/rO4+ZSHcE1NIJgJZSKg 8sjlbtB08vweG56JbcDND3fF53ibUryEICX135pLYG3bsC4Q8ruzc6Ma+TvtDeXTHwM33MsvF tVQd3eif9NsmEZqzVzKcYHbLgDoQWg2A+JiIfQRndbSPDsVYy+Ay3JUmCeYn7ZFjq6NY8TXO3 1nIoWtaTrN9W1r5xM8tfWakhYsFQJyaX//c11AAfO+0cxh4iMcC08pDk9QZwllNBAiUjFntie InGkwKVM9TAEuYV9xcFx3LCLQHbz6e+wFVR0ucznIZ+ByR6tfFnHbgbeCUxlHbBZdTQ6VC0Ra pjIUhUPpmhaeaqxrG22lgIOto3n9nuJAJhQZ4O3qMDavut9RNfvezxjpK6KwOJswsnE8N3v8d VqB+PpWzim23Bhj2GEew1EEwJoGRJ5nyR7Z53sOsjQhIpefhXyeFTM48xpYuRNe9gAXOmR0tv yvmUSBjWiTHYNd5GLE/lYsKSd9bER4UemBXT1ldjpruX+rtvO9efX48UNuDGxNwNOODywkyoN wCgExlDhOds67DFZlftoVmVkk6CkpIwOZM5uMdb1xLcvdS9geOM9foQ1iJx3Y3h/oi5OcNprz 4vA1z2ITA+EucylTLfWsWdtwCS9Otg1PRqOC4YUDIdFPl8+XM5UtouEZhtImovAFpjRekWKeX lFxI20sdL3JknS/iJnRQBMCVRbxriUkjpYtoJ424WranpTtO/Ztrm2Yg2Nf0JKW6paUHOLcFE bfigrGV Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring 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 --- 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