From 5f598500960dab2bdc9ef34bc81ec2602249367d Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 1 May 2016 22:41:20 +0000 Subject: [PATCH] scst_sysfs, LUN replacement: Initialize 'read_only' before using it See also r6834. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6882 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 43b769591..4bd8e302f 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -1436,14 +1436,14 @@ static int __scst_process_luns_mgmt_store(char *buffer, } case SCST_LUN_ACTION_REPLACE: { - unsigned int flags = (read_only ? SCST_ADD_LUN_READ_ONLY : 0) | - (replace_gen_ua ? SCST_REPL_LUN_GEN_UA : 0); + unsigned int flags = replace_gen_ua ? SCST_REPL_LUN_GEN_UA : 0; res = scst_parse_add_repl_param(acg, dev, pp, &virt_lun, &read_only); if (res != 0) goto out_unlock; + flags |= read_only ? SCST_ADD_LUN_READ_ONLY : 0; res = scst_acg_repl_lun(acg, tgt_kobj ? tgt->tgt_luns_kobj : acg->luns_kobj, dev, virt_lun, flags);