Skip to contentSkip to conversation

Patch "dmaengine: Fix array index out of bounds warning in __get_unmap_pool()" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Dec 18, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

dmaengine: Fix array index out of bounds warning in __get_unmap_pool()

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
dmaengine-fix-array-index-out-of-bounds-warning-in-__get_unmap_pool.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Mon Dec 18 14:12:34 CET 2017

From: Matthias Kaehlcke <[email protected]>
Date: Mon, 13 Mar 2017 14:30:29 -0700
Subject: dmaengine: Fix array index out of bounds warning in __get_unmap_pool()

From: Matthias Kaehlcke <[email protected]>

[ Upstream commit 23f963e91fd81f44f6b316b1c24db563354c6be8 ]

This fixes the following warning when building with clang and CONFIG_DMA_ENGINE_RAID=n :

drivers/dma/dmaengine.c:1102:11: error: array index 2 is past the end of the array (which contains 1 element) [-Werror,-Warray-bounds]

                return &unmap_pool[2];
                        ^          ~

drivers/dma/dmaengine.c:1083:1: note: array 'unmap_pool' declared here
static struct dmaengine_unmap_pool unmap_pool[] = {
^
drivers/dma/dmaengine.c:1104:11: error: array index 3 is past the end of the array (which contains 1 element) [-Werror,-Warray-bounds]

                return &unmap_pool[3];
                        ^          ~

drivers/dma/dmaengine.c:1083:1: note: array 'unmap_pool' declared here static struct dmaengine_unmap_pool unmap_pool[] = {

---
 drivers/dma/dmaengine.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/dma/dmaengine.c +2 -0
@@ -1107,12 +1107,14 @@ static struct dmaengine_unmap_pool *__ge
 	switch (order) {
 	case 0 ... 1:
 		return &unmap_pool[0];
+#if IS_ENABLED(CONFIG_DMA_ENGINE_RAID)
 	case 2 ... 4:
 		return &unmap_pool[1];
 	case 5 ... 7:
 		return &unmap_pool[2];
 	case 8:
 		return &unmap_pool[3];
+#endif
 	default:
 		BUG();
 		return NULL;

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/bluetooth-btusb-driver-to-enable-the-usb-wakeup-feature.patch queue-4.9/dmaengine-fix-array-index-out-of-bounds-warning-in-__get_unmap_pool.patch