summaryrefslogtreecommitdiffstats
path: root/arch/s390/mm
diff options
context:
space:
mode:
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>2016-05-09 11:22:34 +0200
committerChristian Borntraeger <borntraeger@de.ibm.com>2016-06-10 12:07:28 +0200
commit154c8c19c35b6da94a623cb793458e203572083d (patch)
tree9ca37ad9fa34d1495bb1c770b035192c87a15854 /arch/s390/mm
parent8d6037a7b4f21708451d4aec14828f9ebe77b37a (diff)
downloadlinux-154c8c19c35b6da94a623cb793458e203572083d.tar.gz
linux-154c8c19c35b6da94a623cb793458e203572083d.tar.bz2
linux-154c8c19c35b6da94a623cb793458e203572083d.zip
s390/mm: return key via pointer in get_guest_storage_key
Let's just split returning the key and reporting errors. This makes calling code easier and avoids bugs as happened already. Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Diffstat (limited to 'arch/s390/mm')
-rw-r--r--arch/s390/mm/pgtable.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index 4c8d572d59cc..3e35298758d6 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -539,9 +539,9 @@ int set_guest_storage_key(struct mm_struct *mm, unsigned long addr,
}
EXPORT_SYMBOL(set_guest_storage_key);
-unsigned long get_guest_storage_key(struct mm_struct *mm, unsigned long addr)
+int get_guest_storage_key(struct mm_struct *mm, unsigned long addr,
+ unsigned char *key)
{
- unsigned char key;
spinlock_t *ptl;
pgste_t pgste;
pte_t *ptep;
@@ -551,14 +551,14 @@ unsigned long get_guest_storage_key(struct mm_struct *mm, unsigned long addr)
return -EFAULT;
pgste = pgste_get_lock(ptep);
- key = (pgste_val(pgste) & (PGSTE_ACC_BITS | PGSTE_FP_BIT)) >> 56;
+ *key = (pgste_val(pgste) & (PGSTE_ACC_BITS | PGSTE_FP_BIT)) >> 56;
if (!(pte_val(*ptep) & _PAGE_INVALID))
- key = page_get_storage_key(pte_val(*ptep) & PAGE_MASK);
+ *key = page_get_storage_key(pte_val(*ptep) & PAGE_MASK);
/* Reflect guest's logical view, not physical */
- key |= (pgste_val(pgste) & (PGSTE_GR_BIT | PGSTE_GC_BIT)) >> 48;
+ *key |= (pgste_val(pgste) & (PGSTE_GR_BIT | PGSTE_GC_BIT)) >> 48;
pgste_set_unlock(ptep, pgste);
pte_unmap_unlock(ptep, ptl);
- return key;
+ return 0;
}
EXPORT_SYMBOL(get_guest_storage_key);
#endif