From 2ded8743df7569218b5a8dfe56d3e978c55e3651 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 27 Jul 2011 01:31:41 +0000 Subject: [PATCH] Merged revisions 3705 via svnmerge from https://vlnb@scst.svn.sourceforge.net/svnroot/scst/trunk ........ r3705 | bvassche | 2011-07-21 05:52:21 -0400 (Thu, 21 Jul 2011) | 1 line scst/sysfs: do not access scst_dev_handler_types[] outside its bounds ........ git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.1.0.x@3779 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index 57b086e82..739917d4b 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -2450,7 +2450,7 @@ static ssize_t scst_dev_sysfs_type_show(struct kobject *kobj, dev = container_of(kobj, struct scst_device, dev_kobj); pos = sprintf(buf, "%d - %s\n", dev->type, - (unsigned)dev->type > ARRAY_SIZE(scst_dev_handler_types) ? + (unsigned)dev->type >= ARRAY_SIZE(scst_dev_handler_types) ? "unknown" : scst_dev_handler_types[dev->type]); return pos; @@ -4475,7 +4475,7 @@ static ssize_t scst_devt_type_show(struct kobject *kobj, devt = container_of(kobj, struct scst_dev_type, devt_kobj); pos = sprintf(buf, "%d - %s\n", devt->type, - (unsigned)devt->type > ARRAY_SIZE(scst_dev_handler_types) ? + (unsigned)devt->type >= ARRAY_SIZE(scst_dev_handler_types) ? "unknown" : scst_dev_handler_types[devt->type]); return pos;