From eb824e0038c65435862d9aba83a8ffa0832504b6 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 21 Jan 2015 04:20:53 +0000 Subject: [PATCH] Fix returning changeable values for caching mode page Reported by Consus git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5982 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index ca73d4aa9..fab1aab7e 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -3854,9 +3854,10 @@ static int vdisk_caching_pg(unsigned char *p, int pcontrol, if (!virt_dev->nv_cache && vdev_saved_mode_pages_enabled) caching_pg[0] |= 0x80; + memcpy(p, caching_pg, sizeof(caching_pg)); + switch (pcontrol) { case 0: /* current */ - memcpy(p, caching_pg, sizeof(caching_pg)); p[2] |= (virt_dev->wt_flag || virt_dev->nv_cache) ? 0 : WCE; break; case 1: /* changeable */ @@ -3865,11 +3866,9 @@ static int vdisk_caching_pg(unsigned char *p, int pcontrol, p[2] |= WCE; break; case 2: /* default */ - memcpy(p, caching_pg, sizeof(caching_pg)); p[2] |= (DEF_WRITE_THROUGH || virt_dev->nv_cache) ? 0 : WCE; break; case 3: /* saved */ - memcpy(p, caching_pg, sizeof(caching_pg)); p[2] |= (virt_dev->wt_flag_saved || virt_dev->nv_cache) ? 0 : WCE; break; default: