From a72b347ccfa1b6bb22543a5478fe61e17c344a8f Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Mon, 27 Aug 2012 21:42:33 +0000 Subject: [PATCH] scst_sysfs: Avoid NULL ptr deref. Fix online documentation Avoid that the PRINT_ERROR() statement that complains about too many parameters triggers a NULL pointer dereference. Also, fix the online documentation for the LUN deletion command. Signed-off-by: Bart Van Assche git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4483 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_sysfs.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index 5e7e3660c..809f0c227 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -1270,8 +1270,8 @@ static int __scst_process_luns_mgmt_store(char *buffer, goto out_unlock; if (scst_get_next_lexem(&pp)[0] != '\0') { - PRINT_ERROR("Too many parameters for device %s: %s", - p, dev->virt_name); + PRINT_ERROR("Too many parameters for del LUN %ld: %s", + virt_lun, p); res = -EINVAL; goto out_unlock; } @@ -1282,8 +1282,7 @@ static int __scst_process_luns_mgmt_store(char *buffer, break; case SCST_LUN_ACTION_CLEAR: if (scst_get_next_lexem(&pp)[0] != '\0') { - PRINT_ERROR("Too many parameters for device %s: %s", - p, dev->virt_name); + PRINT_ERROR("Too many parameters for clear: %s", p); res = -EINVAL; goto out_unlock; } @@ -1370,7 +1369,7 @@ static ssize_t scst_luns_mgmt_show(struct kobject *kobj, char *buf) { static const char help[] = - "Usage: echo \"add|del H:C:I:L lun [parameters]\" >mgmt\n" + "Usage: echo \"add H:C:I:L lun [parameters]\" >mgmt\n" " echo \"add VNAME lun [parameters]\" >mgmt\n" " echo \"del lun\" >mgmt\n" " echo \"replace H:C:I:L lun [parameters]\" >mgmt\n"