From: Alexander Gordeev Date: Wed, 19 Feb 2014 08:58:18 +0000 (+0100) Subject: skd: Fix out of array boundary access X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=c5e3035c88cbefe60ec155b3f9999413da1ee694;p=linux-beck.git skd: Fix out of array boundary access When enabling MSI-X, interrupts are requested for SKD_MAX_MSIX_COUNT entries in skdev->msix_entries array, while the number of actually allocated entries is skdev->msix_count. This might lead to an out of boundary access in case number of allocated entries is less than SKD_MAX_MSIX_COUNT. This update fixes the described misbehaviour. Signed-off-by: Alexander Gordeev Cc: Jens Axboe Cc: Bartlomiej Zolnierkiewicz Cc: Kyungmin Park Cc: linux-pci@vger.kernel.org Signed-off-by: Jens Axboe --- diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c index eb6e1e0e8db2..3fa0918ddaf8 100644 --- a/drivers/block/skd_main.c +++ b/drivers/block/skd_main.c @@ -3989,7 +3989,7 @@ static int skd_acquire_msix(struct skd_device *skdev) } /* Enable MSI-X vectors for the base queue */ - for (i = 0; i < SKD_MAX_MSIX_COUNT; i++) { + for (i = 0; i < skdev->msix_count; i++) { qentry = &skdev->msix_entries[i]; snprintf(qentry->isr_name, sizeof(qentry->isr_name), "%s%d-msix %s", DRV_NAME, skdev->devno,