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: