linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: eata: drop VLA in reorder()
@ 2018-03-11 21:06 Salvatore Mesoraca
  2018-03-12  3:08 ` Tobin C. Harding
  0 siblings, 1 reply; 9+ messages in thread
From: Salvatore Mesoraca @ 2018-03-11 21:06 UTC (permalink / raw)
  To: linux-kernel
  Cc: kernel-hardening, linux-scsi, James E.J. Bottomley,
	Martin K. Petersen, Dario Ballabio, Kees Cook,
	Salvatore Mesoraca

n_ready will always be less than or equal to MAX_MAILBOXES.
So we avoid a VLA[1] and use fixed-length arrays instead.

[1] https://lkml.org/lkml/2018/3/7/621

Signed-off-by: Salvatore Mesoraca <s.mesoraca16@gmail.com>
---
 drivers/scsi/eata.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c
index 6501c33..202cd17 100644
--- a/drivers/scsi/eata.c
+++ b/drivers/scsi/eata.c
@@ -2096,7 +2096,7 @@ static int reorder(struct hostdata *ha, unsigned long cursec,
 	unsigned int k, n;
 	unsigned int rev = 0, s = 1, r = 1;
 	unsigned int input_only = 1, overlap = 0;
-	unsigned long sl[n_ready], pl[n_ready], ll[n_ready];
+	unsigned long sl[MAX_MAILBOXES], pl[MAX_MAILBOXES], ll[MAX_MAILBOXES];
 	unsigned long maxsec = 0, minsec = ULONG_MAX, seek = 0, iseek = 0;
 	unsigned long ioseek = 0;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-03-13 22:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-11 21:06 [PATCH] scsi: eata: drop VLA in reorder() Salvatore Mesoraca
2018-03-12  3:08 ` Tobin C. Harding
2018-03-12  6:36   ` valdis.kletnieks
2018-03-12 10:11   ` Salvatore Mesoraca
2018-03-12 18:45   ` Linus Torvalds
2018-03-13  0:44     ` Arthur Marsh
2018-03-13  2:35     ` Martin K. Petersen
2018-03-13  9:05       ` Christoph Hellwig
2018-03-13 22:04         ` Salvatore Mesoraca

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).