From b50f3aa7cf6c98df880636ad0bf359b311270514 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 10 Oct 2012 02:48:15 +0000 Subject: [PATCH] scst, procfs: Fix a potential out-of-range array access This patch fixes the following smatch warning: drivers/scst/scst_proc.c: scst_dev_handler_type_info_show() error: buffer overflow 'scst_proc_dev_handler_type' 16 <= 16 Signed-off-by: Bart Van Assche git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4555 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scst/src/scst_proc.c b/scst/src/scst_proc.c index dd092cc8e..fc5c1059e 100644 --- a/scst/src/scst_proc.c +++ b/scst/src/scst_proc.c @@ -2378,7 +2378,7 @@ static int scst_dev_handler_type_info_show(struct seq_file *seq, void *v) TRACE_ENTRY(); seq_printf(seq, "%d - %s\n", dev_type->type, - dev_type->type > (int)ARRAY_SIZE(scst_proc_dev_handler_type) + dev_type->type >= (int)ARRAY_SIZE(scst_proc_dev_handler_type) ? "unknown" : scst_proc_dev_handler_type[dev_type->type]); TRACE_EXIT();